Add fields to GraphQL snippet blob type

In this commit we add the fields external_storage and rendered_as_text
to the GraphQL snippet blob type.
parent 13ee246a
......@@ -49,6 +49,15 @@ module Types
field :mode, type: GraphQL::STRING_TYPE,
description: 'Blob mode',
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
# rubocop: enable Graphql/AuthorizeTypes
end
......
---
title: Add fields to GraphQL snippet blob type
merge_request: 31710
author:
type: changed
......@@ -9399,6 +9399,11 @@ type SnippetBlob {
"""
binary: Boolean!
"""
Blob external storage
"""
externalStorage: String
"""
Blob mode
"""
......@@ -9424,6 +9429,11 @@ type SnippetBlob {
"""
rawPath: String!
"""
Shows whether the blob is rendered as text
"""
renderedAsText: Boolean!
"""
Blob highlighted data
"""
......
......@@ -27882,6 +27882,20 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "externalStorage",
"description": "Blob external storage",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "mode",
"description": "Blob mode",
......@@ -27956,6 +27970,24 @@
"isDeprecated": false,
"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",
"description": "Blob highlighted data",
......
......@@ -1392,11 +1392,13 @@ Represents the snippet blob
| Name | Type | Description |
| --- | ---- | ---------- |
| `binary` | Boolean! | Shows whether the blob is binary |
| `externalStorage` | String | Blob external storage |
| `mode` | String | Blob mode |
| `name` | String | Blob name |
| `path` | String | Blob path |
| `plainData` | String | Blob plain highlighted data |
| `rawPath` | String! | Blob raw content endpoint path |
| `renderedAsText` | Boolean! | Shows whether the blob is rendered as text |
| `richData` | String | Blob highlighted data |
| `richViewer` | SnippetBlobViewer | Blob content rich viewer |
| `simpleViewer` | SnippetBlobViewer! | Blob content simple viewer |
......
......@@ -6,8 +6,22 @@ describe GitlabSchema.types['SnippetBlob'] do
it 'has the correct fields' do
expected_fields = [:rich_data, :plain_data,
: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)
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
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