Commit a7b989d8 authored by Siddharth Asthana's avatar Siddharth Asthana

Fix GraphQL/OrderedFields offenses

Changelog: other
parent 739c74e6
...@@ -7,21 +7,21 @@ module Types ...@@ -7,21 +7,21 @@ module Types
authorize :read_release authorize :read_release
field :external, GraphQL::Types::Boolean, null: true, method: :external?,
description: 'Indicates the link points to an external resource.'
field :id, GraphQL::Types::ID, null: false, field :id, GraphQL::Types::ID, null: false,
description: 'ID of the link.' description: 'ID of the link.'
field :link_type, Types::ReleaseAssetLinkTypeEnum, null: true,
description: 'Type of the link: `other`, `runbook`, `image`, `package`; defaults to `other`.'
field :name, GraphQL::Types::String, null: true, field :name, GraphQL::Types::String, null: true,
description: 'Name of the link.' description: 'Name of the link.'
field :url, GraphQL::Types::String, null: true, field :url, GraphQL::Types::String, null: true,
description: 'URL of the link.' description: 'URL of the link.'
field :link_type, Types::ReleaseAssetLinkTypeEnum, null: true,
description: 'Type of the link: `other`, `runbook`, `image`, `package`; defaults to `other`.'
field :external, GraphQL::Types::Boolean, null: true, method: :external?,
description: 'Indicates the link points to an external resource.'
field :direct_asset_url, GraphQL::Types::String, null: true,
description: 'Direct asset URL of the link.'
field :direct_asset_path, GraphQL::Types::String, null: true, method: :filepath, field :direct_asset_path, GraphQL::Types::String, null: true, method: :filepath,
description: 'Relative path for the direct asset link.' description: 'Relative path for the direct asset link.'
field :direct_asset_url, GraphQL::Types::String, null: true,
description: 'Direct asset URL of the link.'
def direct_asset_url def direct_asset_url
return object.url unless object.filepath return object.url unless object.filepath
......
...@@ -10,25 +10,25 @@ module Types ...@@ -10,25 +10,25 @@ module Types
present_using ReleasePresenter present_using ReleasePresenter
field :self_url, GraphQL::Types::String, null: true, field :closed_issues_url, GraphQL::Types::String, null: true,
description: 'HTTP URL of the release.' description: 'HTTP URL of the issues page, filtered by this release and `state=closed`.',
authorize: :download_code
field :closed_merge_requests_url, GraphQL::Types::String, null: true,
description: 'HTTP URL of the merge request page , filtered by this release and `state=closed`.',
authorize: :download_code
field :edit_url, GraphQL::Types::String, null: true, field :edit_url, GraphQL::Types::String, null: true,
description: "HTTP URL of the release's edit page.", description: "HTTP URL of the release's edit page.",
authorize: :update_release authorize: :update_release
field :opened_merge_requests_url, GraphQL::Types::String, null: true,
description: 'HTTP URL of the merge request page, filtered by this release and `state=open`.',
authorize: :download_code
field :merged_merge_requests_url, GraphQL::Types::String, null: true, field :merged_merge_requests_url, GraphQL::Types::String, null: true,
description: 'HTTP URL of the merge request page , filtered by this release and `state=merged`.', description: 'HTTP URL of the merge request page , filtered by this release and `state=merged`.',
authorize: :download_code authorize: :download_code
field :closed_merge_requests_url, GraphQL::Types::String, null: true,
description: 'HTTP URL of the merge request page , filtered by this release and `state=closed`.',
authorize: :download_code
field :opened_issues_url, GraphQL::Types::String, null: true, field :opened_issues_url, GraphQL::Types::String, null: true,
description: 'HTTP URL of the issues page, filtered by this release and `state=open`.', description: 'HTTP URL of the issues page, filtered by this release and `state=open`.',
authorize: :download_code authorize: :download_code
field :closed_issues_url, GraphQL::Types::String, null: true, field :opened_merge_requests_url, GraphQL::Types::String, null: true,
description: 'HTTP URL of the issues page, filtered by this release and `state=closed`.', description: 'HTTP URL of the merge request page, filtered by this release and `state=open`.',
authorize: :download_code authorize: :download_code
field :self_url, GraphQL::Types::String, null: true,
description: 'HTTP URL of the release.'
end end
end end
...@@ -13,30 +13,30 @@ module Types ...@@ -13,30 +13,30 @@ module Types
present_using ReleasePresenter present_using ReleasePresenter
field :tag_name, GraphQL::Types::String, null: true, method: :tag, field :assets, Types::ReleaseAssetsType, null: true, method: :itself,
description: 'Name of the tag associated with the release.' description: 'Assets of the release.'
field :tag_path, GraphQL::Types::String, null: true, field :created_at, Types::TimeType, null: true,
description: 'Relative web path to the tag associated with the release.', description: 'Timestamp of when the release was created.'
authorize: :download_code
field :description, GraphQL::Types::String, null: true, field :description, GraphQL::Types::String, null: true,
description: 'Description (also known as "release notes") of the release.' description: 'Description (also known as "release notes") of the release.'
field :evidences, Types::EvidenceType.connection_type, null: true,
description: 'Evidence for the release.'
field :links, Types::ReleaseLinksType, null: true, method: :itself,
description: 'Links of the release.'
field :milestones, Types::MilestoneType.connection_type, null: true,
description: 'Milestones associated to the release.',
resolver: ::Resolvers::ReleaseMilestonesResolver
field :name, GraphQL::Types::String, null: true, field :name, GraphQL::Types::String, null: true,
description: 'Name of the release.' description: 'Name of the release.'
field :created_at, Types::TimeType, null: true,
description: 'Timestamp of when the release was created.'
field :released_at, Types::TimeType, null: true, field :released_at, Types::TimeType, null: true,
description: 'Timestamp of when the release was released.' description: 'Timestamp of when the release was released.'
field :tag_name, GraphQL::Types::String, null: true, method: :tag,
description: 'Name of the tag associated with the release.'
field :tag_path, GraphQL::Types::String, null: true,
description: 'Relative web path to the tag associated with the release.',
authorize: :download_code
field :upcoming_release, GraphQL::Types::Boolean, null: true, method: :upcoming_release?, field :upcoming_release, GraphQL::Types::Boolean, null: true, method: :upcoming_release?,
description: 'Indicates the release is an upcoming release.' description: 'Indicates the release is an upcoming release.'
field :assets, Types::ReleaseAssetsType, null: true, method: :itself,
description: 'Assets of the release.'
field :links, Types::ReleaseLinksType, null: true, method: :itself,
description: 'Links of the release.'
field :milestones, Types::MilestoneType.connection_type, null: true,
description: 'Milestones associated to the release.',
resolver: ::Resolvers::ReleaseMilestonesResolver
field :evidences, Types::EvidenceType.connection_type, null: true,
description: 'Evidence for the release.'
field :author, Types::UserType, null: true, field :author, Types::UserType, null: true,
description: 'User that created the release.' description: 'User that created the release.'
......
...@@ -6,17 +6,6 @@ module Types ...@@ -6,17 +6,6 @@ module Types
authorize :download_code authorize :download_code
field :root_ref, GraphQL::Types::String, null: true, calls_gitaly: true,
description: 'Default branch of the repository.'
field :empty, GraphQL::Types::Boolean, null: false, method: :empty?, calls_gitaly: true,
description: 'Indicates repository has no visible content.'
field :exists, GraphQL::Types::Boolean, null: false, method: :exists?, calls_gitaly: true,
description: 'Indicates a corresponding Git repository exists on disk.'
field :tree, Types::Tree::TreeType, null: true, resolver: Resolvers::TreeResolver, calls_gitaly: true,
description: 'Tree of the repository.'
field :paginated_tree, Types::Tree::TreeType.connection_type, null: true, resolver: Resolvers::PaginatedTreeResolver, calls_gitaly: true,
max_page_size: 100,
description: 'Paginated tree of the repository.'
field :blobs, Types::Repository::BlobType.connection_type, null: true, resolver: Resolvers::BlobsResolver, calls_gitaly: true, field :blobs, Types::Repository::BlobType.connection_type, null: true, resolver: Resolvers::BlobsResolver, calls_gitaly: true,
description: 'Blobs contained within the repository' description: 'Blobs contained within the repository'
field :branch_names, [GraphQL::Types::String], null: true, calls_gitaly: true, field :branch_names, [GraphQL::Types::String], null: true, calls_gitaly: true,
...@@ -26,5 +15,16 @@ module Types ...@@ -26,5 +15,16 @@ module Types
description: 'Shows a disk path of the repository.', description: 'Shows a disk path of the repository.',
null: true, null: true,
authorize: :read_storage_disk_path authorize: :read_storage_disk_path
field :empty, GraphQL::Types::Boolean, null: false, method: :empty?, calls_gitaly: true,
description: 'Indicates repository has no visible content.'
field :exists, GraphQL::Types::Boolean, null: false, method: :exists?, calls_gitaly: true,
description: 'Indicates a corresponding Git repository exists on disk.'
field :paginated_tree, Types::Tree::TreeType.connection_type, null: true, resolver: Resolvers::PaginatedTreeResolver, calls_gitaly: true,
max_page_size: 100,
description: 'Paginated tree of the repository.'
field :root_ref, GraphQL::Types::String, null: true, calls_gitaly: true,
description: 'Default branch of the repository.'
field :tree, Types::Tree::TreeType, null: true, resolver: Resolvers::TreeResolver, calls_gitaly: true,
description: 'Tree of the repository.'
end end
end end
...@@ -6,15 +6,15 @@ module Types ...@@ -6,15 +6,15 @@ module Types
authorize :read_statistics authorize :read_statistics
field :storage_size, GraphQL::Types::Float, null: false, description: 'Total storage in bytes.'
field :repository_size, GraphQL::Types::Float, null: false, description: 'Git repository size in bytes.'
field :lfs_objects_size, GraphQL::Types::Float, null: false, description: 'LFS objects size in bytes.'
field :build_artifacts_size, GraphQL::Types::Float, null: false, description: 'CI artifacts size in bytes.' field :build_artifacts_size, GraphQL::Types::Float, null: false, description: 'CI artifacts size in bytes.'
field :dependency_proxy_size, GraphQL::Types::Float, null: false, description: 'Dependency Proxy sizes in bytes.'
field :lfs_objects_size, GraphQL::Types::Float, null: false, description: 'LFS objects size in bytes.'
field :packages_size, GraphQL::Types::Float, null: false, description: 'Packages size in bytes.' field :packages_size, GraphQL::Types::Float, null: false, description: 'Packages size in bytes.'
field :wiki_size, GraphQL::Types::Float, null: false, description: 'Wiki size in bytes.'
field :snippets_size, GraphQL::Types::Float, null: false, description: 'Snippets size in bytes.'
field :pipeline_artifacts_size, GraphQL::Types::Float, null: false, description: 'CI pipeline artifacts size in bytes.' field :pipeline_artifacts_size, GraphQL::Types::Float, null: false, description: 'CI pipeline artifacts size in bytes.'
field :repository_size, GraphQL::Types::Float, null: false, description: 'Git repository size in bytes.'
field :snippets_size, GraphQL::Types::Float, null: false, description: 'Snippets size in bytes.'
field :storage_size, GraphQL::Types::Float, null: false, description: 'Total storage in bytes.'
field :uploads_size, GraphQL::Types::Float, null: false, description: 'Uploads size in bytes.' field :uploads_size, GraphQL::Types::Float, null: false, description: 'Uploads size in bytes.'
field :dependency_proxy_size, GraphQL::Types::Float, null: false, description: 'Dependency Proxy sizes in bytes.' field :wiki_size, GraphQL::Types::Float, null: false, description: 'Wiki size in bytes.'
end end
end end
...@@ -8,10 +8,10 @@ module Types ...@@ -8,10 +8,10 @@ module Types
graphql_name 'TaskCompletionStatus' graphql_name 'TaskCompletionStatus'
description 'Completion status of tasks' description 'Completion status of tasks'
field :count, GraphQL::Types::Int, null: false,
description: 'Number of total tasks.'
field :completed_count, GraphQL::Types::Int, null: false, field :completed_count, GraphQL::Types::Int, null: false,
description: 'Number of completed tasks.' description: 'Number of completed tasks.'
field :count, GraphQL::Types::Int, null: false,
description: 'Number of total tasks.'
end end
# rubocop: enable Graphql/AuthorizeTypes # rubocop: enable Graphql/AuthorizeTypes
end end
...@@ -9,15 +9,15 @@ module Types ...@@ -9,15 +9,15 @@ module Types
implements Types::Tree::EntryType implements Types::Tree::EntryType
present_using BlobPresenter present_using BlobPresenter
field :web_url, GraphQL::Types::String, null: true,
description: 'Web URL of the blob.'
field :web_path, GraphQL::Types::String, null: true,
description: 'Web path of the blob.'
field :lfs_oid, GraphQL::Types::String, null: true, field :lfs_oid, GraphQL::Types::String, null: true,
calls_gitaly: true, calls_gitaly: true,
description: 'LFS ID of the blob.' description: 'LFS ID of the blob.'
field :mode, GraphQL::Types::String, null: true, field :mode, GraphQL::Types::String, null: true,
description: 'Blob mode in numeric format.' description: 'Blob mode in numeric format.'
field :web_path, GraphQL::Types::String, null: true,
description: 'Web path of the blob.'
field :web_url, GraphQL::Types::String, null: true,
description: 'Web URL of the blob.'
def lfs_oid def lfs_oid
Gitlab::Graphql::Loaders::BatchLfsOidLoader.new(object.repository, object.id).find Gitlab::Graphql::Loaders::BatchLfsOidLoader.new(object.repository, object.id).find
......
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