Commit 64c0c4b1 authored by Thomas Randolph's avatar Thomas Randolph Committed by Imre Farkas

Expose blob mode in GraphQL for repository files

parent 2e1e1406
......@@ -45,6 +45,7 @@ query getFiles(
edges {
node {
...TreeEntry
mode
webUrl
lfsOid
}
......
......@@ -17,6 +17,8 @@ module Types
resolve: -> (blob, args, ctx) do
Gitlab::Graphql::Loaders::BatchLfsOidLoader.new(blob.repository, blob.id).find
end
field :mode, GraphQL::STRING_TYPE, null: true,
description: 'Blob mode in numeric format'
# rubocop: enable Graphql/AuthorizeTypes
end
end
......
---
title: Expose blob mode in GraphQL for repository files
merge_request: 36488
author:
type: other
......@@ -793,6 +793,11 @@ type Blob implements Entry {
"""
lfsOid: String
"""
Blob mode in numeric format
"""
mode: String
"""
Name of the entry
"""
......
......@@ -2056,6 +2056,20 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "mode",
"description": "Blob mode in numeric format",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "name",
"description": "Name of the entry",
......@@ -160,6 +160,7 @@ Autogenerated return type of AwardEmojiToggle
| `flatPath` | String! | Flat path of the entry |
| `id` | ID! | ID of the entry |
| `lfsOid` | String | LFS ID of the blob |
| `mode` | String | Blob mode in numeric format |
| `name` | String! | Name of the entry |
| `path` | String! | Path of the entry |
| `sha` | String! | Last commit sha for the entry |
......
......@@ -5,5 +5,5 @@ require 'spec_helper'
RSpec.describe Types::Tree::BlobType do
specify { expect(described_class.graphql_name).to eq('Blob') }
specify { expect(described_class).to have_graphql_fields(:id, :sha, :name, :type, :path, :flat_path, :web_url, :lfs_oid) }
specify { expect(described_class).to have_graphql_fields(:id, :sha, :name, :type, :path, :flat_path, :web_url, :lfs_oid, :mode) }
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