diff --git a/app/graphql/types/snippets/blob_type.rb b/app/graphql/types/snippets/blob_type.rb index f398fe9c1214a7223ff1d4a107b385294223651b..cacb2177192ee3ce21fa7c66ec947980100a48c9 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 0000000000000000000000000000000000000000..03ed04d9057e1148efb94708d7d3aa7fbf32dbe4 --- /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 eb72823337965e5062dda1cf422309d9cb35ab41..2c63ecfe08e1c6581ddcb269e39557daf3037308 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 d346c8a886f75da8ec91658bd735c97abc0cfacb..a35bf8caccf4933c0d69b1629eacd17a3c6ef9ed 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 7360ce0978a531674ac50da93435eaa5b7935fb0..a0d1787e816a2b2666f2a0f13d03c3bb4b66d09b 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 f1837538b53ef7dae3aa5bbfa65bf6c141abf52b..e7d4e5dfa2d31cdc652bf5e32f7a1d3fd23622ab 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