Commit 899f88a2 authored by Jarka Košanová's avatar Jarka Košanová

Merge branch 'fj-expand-graphql-snippet-blob-type' into 'master'

Add fields to GraphQL snippet blob type

See merge request gitlab-org/gitlab!31710
parents 880b927d 57208be5
...@@ -49,6 +49,15 @@ module Types ...@@ -49,6 +49,15 @@ module Types
field :mode, type: GraphQL::STRING_TYPE, field :mode, type: GraphQL::STRING_TYPE,
description: 'Blob mode', description: 'Blob mode',
null: true null: true
field :external_storage, type: GraphQL::STRING_TYPE,
description: 'Blob external storage',
null: true
field :rendered_as_text, type: GraphQL::BOOLEAN_TYPE,
description: 'Shows whether the blob is rendered as text',
method: :rendered_as_text?,
null: false
end end
# rubocop: enable Graphql/AuthorizeTypes # rubocop: enable Graphql/AuthorizeTypes
end end
......
---
title: Add fields to GraphQL snippet blob type
merge_request: 31710
author:
type: changed
...@@ -9399,6 +9399,11 @@ type SnippetBlob { ...@@ -9399,6 +9399,11 @@ type SnippetBlob {
""" """
binary: Boolean! binary: Boolean!
"""
Blob external storage
"""
externalStorage: String
""" """
Blob mode Blob mode
""" """
...@@ -9424,6 +9429,11 @@ type SnippetBlob { ...@@ -9424,6 +9429,11 @@ type SnippetBlob {
""" """
rawPath: String! rawPath: String!
"""
Shows whether the blob is rendered as text
"""
renderedAsText: Boolean!
""" """
Blob highlighted data Blob highlighted data
""" """
......
...@@ -27882,6 +27882,20 @@ ...@@ -27882,6 +27882,20 @@
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
}, },
{
"name": "externalStorage",
"description": "Blob external storage",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{ {
"name": "mode", "name": "mode",
"description": "Blob mode", "description": "Blob mode",
...@@ -27956,6 +27970,24 @@ ...@@ -27956,6 +27970,24 @@
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
}, },
{
"name": "renderedAsText",
"description": "Shows whether the blob is rendered as text",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{ {
"name": "richData", "name": "richData",
"description": "Blob highlighted data", "description": "Blob highlighted data",
......
...@@ -1392,11 +1392,13 @@ Represents the snippet blob ...@@ -1392,11 +1392,13 @@ Represents the snippet blob
| Name | Type | Description | | Name | Type | Description |
| --- | ---- | ---------- | | --- | ---- | ---------- |
| `binary` | Boolean! | Shows whether the blob is binary | | `binary` | Boolean! | Shows whether the blob is binary |
| `externalStorage` | String | Blob external storage |
| `mode` | String | Blob mode | | `mode` | String | Blob mode |
| `name` | String | Blob name | | `name` | String | Blob name |
| `path` | String | Blob path | | `path` | String | Blob path |
| `plainData` | String | Blob plain highlighted data | | `plainData` | String | Blob plain highlighted data |
| `rawPath` | String! | Blob raw content endpoint path | | `rawPath` | String! | Blob raw content endpoint path |
| `renderedAsText` | Boolean! | Shows whether the blob is rendered as text |
| `richData` | String | Blob highlighted data | | `richData` | String | Blob highlighted data |
| `richViewer` | SnippetBlobViewer | Blob content rich viewer | | `richViewer` | SnippetBlobViewer | Blob content rich viewer |
| `simpleViewer` | SnippetBlobViewer! | Blob content simple viewer | | `simpleViewer` | SnippetBlobViewer! | Blob content simple viewer |
......
...@@ -6,8 +6,22 @@ describe GitlabSchema.types['SnippetBlob'] do ...@@ -6,8 +6,22 @@ describe GitlabSchema.types['SnippetBlob'] do
it 'has the correct fields' do it 'has the correct fields' do
expected_fields = [:rich_data, :plain_data, expected_fields = [:rich_data, :plain_data,
:raw_path, :size, :binary, :name, :path, :raw_path, :size, :binary, :name, :path,
:simple_viewer, :rich_viewer, :mode] :simple_viewer, :rich_viewer, :mode, :external_storage,
:rendered_as_text]
expect(described_class).to have_graphql_fields(*expected_fields) expect(described_class).to have_graphql_fields(*expected_fields)
end end
specify { expect(described_class.fields['richData'].type).not_to be_non_null }
specify { expect(described_class.fields['plainData'].type).not_to be_non_null }
specify { expect(described_class.fields['rawPath'].type).to be_non_null }
specify { expect(described_class.fields['size'].type).to be_non_null }
specify { expect(described_class.fields['binary'].type).to be_non_null }
specify { expect(described_class.fields['name'].type).not_to be_non_null }
specify { expect(described_class.fields['path'].type).not_to be_non_null }
specify { expect(described_class.fields['simpleViewer'].type).to be_non_null }
specify { expect(described_class.fields['richViewer'].type).not_to be_non_null }
specify { expect(described_class.fields['mode'].type).not_to be_non_null }
specify { expect(described_class.fields['externalStorage'].type).not_to be_non_null }
specify { expect(described_class.fields['renderedAsText'].type).to be_non_null }
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment