From f66036d05d3ff36e66e54709e9b00068aa4d6914 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Javier=20L=C3=B3pez?= Date: Fri, 31 Jan 2020 11:42:16 +0100 Subject: [PATCH] Add mode field to snippet blob in GraphQL --- app/graphql/types/snippets/blob_type.rb | 4 ++++ .../fj-add-mode-field-to-snippet-blob-type.yml | 5 +++++ doc/api/graphql/reference/gitlab_schema.graphql | 5 +++++ doc/api/graphql/reference/gitlab_schema.json | 14 ++++++++++++++ doc/api/graphql/reference/index.md | 1 + spec/graphql/types/snippets/blob_type_spec.rb | 3 ++- 6 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 changelogs/unreleased/fj-add-mode-field-to-snippet-blob-type.yml diff --git a/app/graphql/types/snippets/blob_type.rb b/app/graphql/types/snippets/blob_type.rb index f398fe9c1214a7..cacb2177192ee3 100644 --- a/app/graphql/types/snippets/blob_type.rb +++ b/app/graphql/types/snippets/blob_type.rb @@ -40,6 +40,10 @@ class BlobType < BaseObject field :rich_viewer, type: Types::Snippets::BlobViewerType, description: 'Blob content rich viewer', null: true + + field :mode, type: GraphQL::STRING_TYPE, + description: 'Blob mode', + null: true end # rubocop: enable Graphql/AuthorizeTypes end diff --git a/changelogs/unreleased/fj-add-mode-field-to-snippet-blob-type.yml b/changelogs/unreleased/fj-add-mode-field-to-snippet-blob-type.yml new file mode 100644 index 00000000000000..03ed04d9057e11 --- /dev/null +++ b/changelogs/unreleased/fj-add-mode-field-to-snippet-blob-type.yml @@ -0,0 +1,5 @@ +--- +title: Add mode field to snippet blob in GraphQL +merge_request: 24157 +author: +type: changed diff --git a/doc/api/graphql/reference/gitlab_schema.graphql b/doc/api/graphql/reference/gitlab_schema.graphql index eb72823337965e..2c63ecfe08e1c6 100644 --- a/doc/api/graphql/reference/gitlab_schema.graphql +++ b/doc/api/graphql/reference/gitlab_schema.graphql @@ -6641,6 +6641,11 @@ type SnippetBlob { """ highlightedData: String + """ + Blob mode + """ + mode: String + """ Blob name """ diff --git a/doc/api/graphql/reference/gitlab_schema.json b/doc/api/graphql/reference/gitlab_schema.json index d346c8a886f75d..a35bf8caccf493 100644 --- a/doc/api/graphql/reference/gitlab_schema.json +++ b/doc/api/graphql/reference/gitlab_schema.json @@ -7171,6 +7171,20 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "mode", + "description": "Blob mode", + "args": [ + + ], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "name", "description": "Blob name", diff --git a/doc/api/graphql/reference/index.md b/doc/api/graphql/reference/index.md index 7360ce0978a531..a0d1787e816a2b 100644 --- a/doc/api/graphql/reference/index.md +++ b/doc/api/graphql/reference/index.md @@ -1063,6 +1063,7 @@ Represents the snippet blob | --- | ---- | ---------- | | `binary` | Boolean! | Shows whether the blob is binary | | `highlightedData` | String | Blob highlighted data | +| `mode` | String | Blob mode | | `name` | String | Blob name | | `path` | String | Blob path | | `rawPath` | String! | Blob raw content endpoint path | diff --git a/spec/graphql/types/snippets/blob_type_spec.rb b/spec/graphql/types/snippets/blob_type_spec.rb index f1837538b53ef7..e7d4e5dfa2d31c 100644 --- a/spec/graphql/types/snippets/blob_type_spec.rb +++ b/spec/graphql/types/snippets/blob_type_spec.rb @@ -6,7 +6,8 @@ it 'has the correct fields' do expected_fields = [:highlighted_data, :raw_path, :size, :binary, :name, :path, - :simple_viewer, :rich_viewer] + :simple_viewer, :rich_viewer, + :mode] is_expected.to have_graphql_fields(*expected_fields) end -- GitLab