diff options
Diffstat (limited to 'app/graphql/types')
150 files changed, 933 insertions, 697 deletions
diff --git a/app/graphql/types/access_level_type.rb b/app/graphql/types/access_level_type.rb index 21c3669979c..2d97f6b30e8 100644 --- a/app/graphql/types/access_level_type.rb +++ b/app/graphql/types/access_level_type.rb @@ -6,7 +6,7 @@ module Types graphql_name 'AccessLevel' description 'Represents the access level of a relationship between a User and object that it is related to' - field :integer_value, GraphQL::INT_TYPE, null: true, + field :integer_value, GraphQL::Types::Int, null: true, description: 'Integer representation of access level.', method: :to_i diff --git a/app/graphql/types/admin/analytics/usage_trends/measurement_type.rb b/app/graphql/types/admin/analytics/usage_trends/measurement_type.rb index c8ca702706f..c54c938402d 100644 --- a/app/graphql/types/admin/analytics/usage_trends/measurement_type.rb +++ b/app/graphql/types/admin/analytics/usage_trends/measurement_type.rb @@ -14,7 +14,7 @@ module Types field :recorded_at, Types::TimeType, null: true, description: 'The time the measurement was recorded.' - field :count, GraphQL::INT_TYPE, null: false, + field :count, GraphQL::Types::Int, null: false, description: 'Object count.' field :identifier, Types::Admin::Analytics::UsageTrends::MeasurementIdentifierEnum, null: false, diff --git a/app/graphql/types/admin/sidekiq_queues/delete_jobs_response_type.rb b/app/graphql/types/admin/sidekiq_queues/delete_jobs_response_type.rb index 996300edad3..cc6e3db007b 100644 --- a/app/graphql/types/admin/sidekiq_queues/delete_jobs_response_type.rb +++ b/app/graphql/types/admin/sidekiq_queues/delete_jobs_response_type.rb @@ -10,17 +10,17 @@ module Types description 'The response from the AdminSidekiqQueuesDeleteJobs mutation' field :completed, - GraphQL::BOOLEAN_TYPE, + GraphQL::Types::Boolean, null: true, description: 'Whether or not the entire queue was processed in time; if not, retrying the same request is safe.' field :deleted_jobs, - GraphQL::INT_TYPE, + GraphQL::Types::Int, null: true, description: 'The number of matching jobs deleted.' field :queue_size, - GraphQL::INT_TYPE, + GraphQL::Types::Int, null: true, description: 'The queue size after processing.' end diff --git a/app/graphql/types/alert_management/alert_status_counts_type.rb b/app/graphql/types/alert_management/alert_status_counts_type.rb index 14a81735fa5..c4aedb09997 100644 --- a/app/graphql/types/alert_management/alert_status_counts_type.rb +++ b/app/graphql/types/alert_management/alert_status_counts_type.rb @@ -11,18 +11,18 @@ module Types ::AlertManagement::Alert.status_names.each do |status| field status, - GraphQL::INT_TYPE, + GraphQL::Types::Int, null: true, description: "Number of alerts with status #{status.to_s.upcase} for the project" end field :open, - GraphQL::INT_TYPE, + GraphQL::Types::Int, null: true, description: 'Number of alerts with status TRIGGERED or ACKNOWLEDGED for the project.' field :all, - GraphQL::INT_TYPE, + GraphQL::Types::Int, null: true, description: 'Total number of alerts for the project.' end diff --git a/app/graphql/types/alert_management/alert_type.rb b/app/graphql/types/alert_management/alert_type.rb index eb0d999554f..bdfdd2c5886 100644 --- a/app/graphql/types/alert_management/alert_type.rb +++ b/app/graphql/types/alert_management/alert_type.rb @@ -13,12 +13,12 @@ module Types authorize :read_alert_management_alert field :iid, - GraphQL::ID_TYPE, + GraphQL::Types::ID, null: false, description: 'Internal ID of the alert.' field :issue_iid, - GraphQL::ID_TYPE, + GraphQL::Types::ID, null: true, deprecated: { reason: 'Use issue field', milestone: '13.10' }, description: 'Internal ID of the GitLab issue attached to the alert.' @@ -29,12 +29,12 @@ module Types description: 'Issue attached to the alert.' field :title, - GraphQL::STRING_TYPE, + GraphQL::Types::String, null: true, description: 'Title of the alert.' field :description, - GraphQL::STRING_TYPE, + GraphQL::Types::String, null: true, description: 'Description of the alert.' @@ -50,17 +50,17 @@ module Types method: :status_name field :service, - GraphQL::STRING_TYPE, + GraphQL::Types::String, null: true, description: 'Service the alert came from.' field :monitoring_tool, - GraphQL::STRING_TYPE, + GraphQL::Types::String, null: true, description: 'Monitoring tool the alert came from.' field :hosts, - [GraphQL::STRING_TYPE], + [GraphQL::Types::String], null: true, description: 'List of hosts the alert came from.' @@ -80,7 +80,7 @@ module Types description: 'Environment for the alert.' field :event_count, - GraphQL::INT_TYPE, + GraphQL::Types::Int, null: true, description: 'Number of events of this alert.', method: :events @@ -106,12 +106,12 @@ module Types description: 'Assignees of the alert.' field :metrics_dashboard_url, - GraphQL::STRING_TYPE, + GraphQL::Types::String, null: true, description: 'URL for metrics embed for the alert.' field :runbook, - GraphQL::STRING_TYPE, + GraphQL::Types::String, null: true, description: 'Runbook for the alert as defined in alert details.' @@ -120,7 +120,7 @@ module Types end field :details_url, - GraphQL::STRING_TYPE, + GraphQL::Types::String, null: false, description: 'The URL of the alert detail page.' diff --git a/app/graphql/types/alert_management/integration_type.rb b/app/graphql/types/alert_management/integration_type.rb index 6cbc17cdbfb..ca7ec99a480 100644 --- a/app/graphql/types/alert_management/integration_type.rb +++ b/app/graphql/types/alert_management/integration_type.rb @@ -7,7 +7,7 @@ module Types graphql_name 'AlertManagementIntegration' field :id, - GraphQL::ID_TYPE, + GraphQL::Types::ID, null: false, description: 'ID of the integration.' @@ -17,27 +17,27 @@ module Types description: 'Type of integration.' field :name, - GraphQL::STRING_TYPE, + GraphQL::Types::String, null: true, description: 'Name of the integration.' field :active, - GraphQL::BOOLEAN_TYPE, + GraphQL::Types::Boolean, null: true, description: 'Whether the endpoint is currently accepting alerts.' field :token, - GraphQL::STRING_TYPE, + GraphQL::Types::String, null: true, description: 'Token used to authenticate alert notification requests.' field :url, - GraphQL::STRING_TYPE, + GraphQL::Types::String, null: true, description: 'Endpoint which accepts alert notifications.' field :api_url, - GraphQL::STRING_TYPE, + GraphQL::Types::String, null: true, description: 'URL at which Prometheus metrics can be queried to populate the metrics dashboard.' diff --git a/app/graphql/types/award_emojis/award_emoji_type.rb b/app/graphql/types/award_emojis/award_emoji_type.rb index 9409304e28f..1f6f0badcac 100644 --- a/app/graphql/types/award_emojis/award_emoji_type.rb +++ b/app/graphql/types/award_emojis/award_emoji_type.rb @@ -11,27 +11,27 @@ module Types present_using AwardEmojiPresenter field :name, - GraphQL::STRING_TYPE, + GraphQL::Types::String, null: false, description: 'The emoji name.' field :description, - GraphQL::STRING_TYPE, + GraphQL::Types::String, null: false, description: 'The emoji description.' field :unicode, - GraphQL::STRING_TYPE, + GraphQL::Types::String, null: false, description: 'The emoji in Unicode.' field :emoji, - GraphQL::STRING_TYPE, + GraphQL::Types::String, null: false, description: 'The emoji as an icon.' field :unicode_version, - GraphQL::STRING_TYPE, + GraphQL::Types::String, null: false, description: 'The Unicode version for this emoji.' diff --git a/app/graphql/types/base_argument.rb b/app/graphql/types/base_argument.rb index 536a32f2bdd..2c899e9edaa 100644 --- a/app/graphql/types/base_argument.rb +++ b/app/graphql/types/base_argument.rb @@ -10,7 +10,29 @@ module Types @deprecation = gitlab_deprecation(kwargs) @doc_reference = kwargs.delete(:see) + # our custom addition `nullable` which allows us to declare + # an argument that must be provided, even if its value is null. + # When `required: true` then required arguments must not be null. + @gl_required = !!kwargs[:required] + @gl_nullable = kwargs[:required] == :nullable + + # Only valid if an argument is also required. + if @gl_nullable + # Since the framework asserts that "required" means "cannot be null" + # we have to switch off "required" but still do the check in `ready?` behind the scenes + kwargs[:required] = false + end + super(*args, **kwargs, &block) end + + def accepts?(value) + # if the argument is declared as required, it must be included + return false if @gl_required && value == :not_given + # if the argument is declared as required, the value can only be null IF it is also nullable. + return false if @gl_required && value.nil? && !@gl_nullable + + true + end end end diff --git a/app/graphql/types/blob_viewer_type.rb b/app/graphql/types/blob_viewer_type.rb index 8d863c32bc7..8c565373cfd 100644 --- a/app/graphql/types/blob_viewer_type.rb +++ b/app/graphql/types/blob_viewer_type.rb @@ -9,30 +9,30 @@ module Types description: 'Type of blob viewer.', null: false - field :load_async, GraphQL::BOOLEAN_TYPE, + field :load_async, GraphQL::Types::Boolean, description: 'Shows whether the blob content is loaded asynchronously.', null: false - field :collapsed, GraphQL::BOOLEAN_TYPE, + field :collapsed, GraphQL::Types::Boolean, description: 'Shows whether the blob should be displayed collapsed.', method: :collapsed?, null: false - field :too_large, GraphQL::BOOLEAN_TYPE, + field :too_large, GraphQL::Types::Boolean, description: 'Shows whether the blob is too large to be displayed.', method: :too_large?, null: false - field :render_error, GraphQL::STRING_TYPE, + field :render_error, GraphQL::Types::String, description: 'Error rendering the blob content.', null: true - field :file_type, GraphQL::STRING_TYPE, + field :file_type, GraphQL::Types::String, description: 'Content file type.', method: :partial_name, null: false - field :loading_partial_name, GraphQL::STRING_TYPE, + field :loading_partial_name, GraphQL::Types::String, description: 'Loading partial name.', null: false diff --git a/app/graphql/types/board_list_type.rb b/app/graphql/types/board_list_type.rb index dc10716dcb0..762e03973d9 100644 --- a/app/graphql/types/board_list_type.rb +++ b/app/graphql/types/board_list_type.rb @@ -10,19 +10,19 @@ module Types alias_method :list, :object - field :id, GraphQL::ID_TYPE, null: false, + field :id, GraphQL::Types::ID, null: false, description: 'ID (global ID) of the list.' - field :title, GraphQL::STRING_TYPE, null: false, + field :title, GraphQL::Types::String, null: false, description: 'Title of the list.' - field :list_type, GraphQL::STRING_TYPE, null: false, + field :list_type, GraphQL::Types::String, null: false, description: 'Type of the list.' - field :position, GraphQL::INT_TYPE, null: true, + field :position, GraphQL::Types::Int, null: true, description: 'Position of list within the board.' field :label, Types::LabelType, null: true, description: 'Label of the list.' - field :collapsed, GraphQL::BOOLEAN_TYPE, null: true, + field :collapsed, GraphQL::Types::Boolean, null: true, description: 'Indicates if the list is collapsed for this user.' - field :issues_count, GraphQL::INT_TYPE, null: true, + field :issues_count, GraphQL::Types::Int, null: true, description: 'Count of issues in the list.' field :issues, ::Types::IssueType.connection_type, null: true, diff --git a/app/graphql/types/board_type.rb b/app/graphql/types/board_type.rb index 292809b0d64..4ec9a8a9c63 100644 --- a/app/graphql/types/board_type.rb +++ b/app/graphql/types/board_type.rb @@ -9,15 +9,15 @@ module Types present_using BoardPresenter - field :id, type: GraphQL::ID_TYPE, null: false, + field :id, type: GraphQL::Types::ID, null: false, description: 'ID (global ID) of the board.' - field :name, type: GraphQL::STRING_TYPE, null: true, + field :name, type: GraphQL::Types::String, null: true, description: 'Name of the board.' - field :hide_backlog_list, type: GraphQL::BOOLEAN_TYPE, null: true, + field :hide_backlog_list, type: GraphQL::Types::Boolean, null: true, description: 'Whether or not backlog list is hidden.' - field :hide_closed_list, type: GraphQL::BOOLEAN_TYPE, null: true, + field :hide_closed_list, type: GraphQL::Types::Boolean, null: true, description: 'Whether or not closed list is hidden.' field :created_at, Types::TimeType, null: false, @@ -33,10 +33,10 @@ module Types resolver: Resolvers::BoardListsResolver, extras: [:lookahead] - field :web_path, GraphQL::STRING_TYPE, null: false, + field :web_path, GraphQL::Types::String, null: false, description: 'Web path of the board.' - field :web_url, GraphQL::STRING_TYPE, null: false, + field :web_url, GraphQL::Types::String, null: false, description: 'Web URL of the board.' end end diff --git a/app/graphql/types/boards/board_issuable_input_base_type.rb b/app/graphql/types/boards/board_issuable_input_base_type.rb index 2cd057347d6..326f73846d0 100644 --- a/app/graphql/types/boards/board_issuable_input_base_type.rb +++ b/app/graphql/types/boards/board_issuable_input_base_type.rb @@ -4,15 +4,15 @@ module Types module Boards # Common arguments that we can be used to filter boards epics and issues class BoardIssuableInputBaseType < BaseInputObject - argument :label_name, [GraphQL::STRING_TYPE, null: true], + argument :label_name, [GraphQL::Types::String, null: true], required: false, description: 'Filter by label name.' - argument :author_username, GraphQL::STRING_TYPE, + argument :author_username, GraphQL::Types::String, required: false, description: 'Filter by author username.' - argument :my_reaction_emoji, GraphQL::STRING_TYPE, + argument :my_reaction_emoji, GraphQL::Types::String, required: false, description: 'Filter by reaction emoji applied by the current user.' end diff --git a/app/graphql/types/boards/board_issue_input_base_type.rb b/app/graphql/types/boards/board_issue_input_base_type.rb index 30f4efcd403..82db1802b81 100644 --- a/app/graphql/types/boards/board_issue_input_base_type.rb +++ b/app/graphql/types/boards/board_issue_input_base_type.rb @@ -4,21 +4,26 @@ module Types module Boards # rubocop: disable Graphql/AuthorizeTypes class BoardIssueInputBaseType < BoardIssuableInputBaseType - argument :iids, [GraphQL::STRING_TYPE], + argument :iids, [GraphQL::Types::String], required: false, description: 'List of IIDs of issues. For example `["1", "2"]`.' - argument :milestone_title, GraphQL::STRING_TYPE, + argument :milestone_title, GraphQL::Types::String, required: false, description: 'Filter by milestone title.' - argument :assignee_username, [GraphQL::STRING_TYPE, null: true], + argument :assignee_username, [GraphQL::Types::String, null: true], required: false, description: 'Filter by assignee username.' - argument :release_tag, GraphQL::STRING_TYPE, + argument :release_tag, GraphQL::Types::String, required: false, description: 'Filter by release tag.' + + argument :types, [Types::IssueTypeEnum], + as: :issue_types, + description: 'Filter by the given issue types.', + required: false end end end diff --git a/app/graphql/types/boards/board_issue_input_type.rb b/app/graphql/types/boards/board_issue_input_type.rb index 7580b0378fe..b4dbe87e32d 100644 --- a/app/graphql/types/boards/board_issue_input_type.rb +++ b/app/graphql/types/boards/board_issue_input_type.rb @@ -10,7 +10,7 @@ module Types prepare: ->(negated_args, ctx) { negated_args.to_h }, description: 'List of negated arguments.' - argument :search, GraphQL::STRING_TYPE, + argument :search, GraphQL::Types::String, required: false, description: 'Search query for issue title or description.' diff --git a/app/graphql/types/branch_type.rb b/app/graphql/types/branch_type.rb index b788ba79769..a861bcc4bb4 100644 --- a/app/graphql/types/branch_type.rb +++ b/app/graphql/types/branch_type.rb @@ -6,7 +6,7 @@ module Types graphql_name 'Branch' field :name, - GraphQL::STRING_TYPE, + GraphQL::Types::String, null: false, description: 'Name of the branch.' diff --git a/app/graphql/types/ci/analytics_type.rb b/app/graphql/types/ci/analytics_type.rb index ba987b133bd..f52b9eae229 100644 --- a/app/graphql/types/ci/analytics_type.rb +++ b/app/graphql/types/ci/analytics_type.rb @@ -6,27 +6,27 @@ module Types class AnalyticsType < BaseObject graphql_name 'PipelineAnalytics' - field :week_pipelines_totals, [GraphQL::INT_TYPE], null: true, + field :week_pipelines_totals, [GraphQL::Types::Int], null: true, description: 'Total weekly pipeline count.' - field :week_pipelines_successful, [GraphQL::INT_TYPE], null: true, + field :week_pipelines_successful, [GraphQL::Types::Int], null: true, description: 'Total weekly successful pipeline count.' - field :week_pipelines_labels, [GraphQL::STRING_TYPE], null: true, + field :week_pipelines_labels, [GraphQL::Types::String], null: true, description: 'Labels for the weekly pipeline count.' - field :month_pipelines_totals, [GraphQL::INT_TYPE], null: true, + field :month_pipelines_totals, [GraphQL::Types::Int], null: true, description: 'Total monthly pipeline count.' - field :month_pipelines_successful, [GraphQL::INT_TYPE], null: true, + field :month_pipelines_successful, [GraphQL::Types::Int], null: true, description: 'Total monthly successful pipeline count.' - field :month_pipelines_labels, [GraphQL::STRING_TYPE], null: true, + field :month_pipelines_labels, [GraphQL::Types::String], null: true, description: 'Labels for the monthly pipeline count.' - field :year_pipelines_totals, [GraphQL::INT_TYPE], null: true, + field :year_pipelines_totals, [GraphQL::Types::Int], null: true, description: 'Total yearly pipeline count.' - field :year_pipelines_successful, [GraphQL::INT_TYPE], null: true, + field :year_pipelines_successful, [GraphQL::Types::Int], null: true, description: 'Total yearly successful pipeline count.' - field :year_pipelines_labels, [GraphQL::STRING_TYPE], null: true, + field :year_pipelines_labels, [GraphQL::Types::String], null: true, description: 'Labels for the yearly pipeline count.' - field :pipeline_times_values, [GraphQL::INT_TYPE], null: true, + field :pipeline_times_values, [GraphQL::Types::Int], null: true, description: 'Pipeline times.' - field :pipeline_times_labels, [GraphQL::STRING_TYPE], null: true, + field :pipeline_times_labels, [GraphQL::Types::String], null: true, description: 'Pipeline times labels.' end end diff --git a/app/graphql/types/ci/application_setting_type.rb b/app/graphql/types/ci/application_setting_type.rb index 8616280057c..2322778d159 100644 --- a/app/graphql/types/ci/application_setting_type.rb +++ b/app/graphql/types/ci/application_setting_type.rb @@ -7,7 +7,7 @@ module Types authorize :read_application_setting - field :keep_latest_artifact, GraphQL::BOOLEAN_TYPE, null: true, + field :keep_latest_artifact, GraphQL::Types::Boolean, null: true, description: 'Whether to keep the latest jobs artifacts.' end end diff --git a/app/graphql/types/ci/build_need_type.rb b/app/graphql/types/ci/build_need_type.rb index 19ff758ad1d..7bd12c99a08 100644 --- a/app/graphql/types/ci/build_need_type.rb +++ b/app/graphql/types/ci/build_need_type.rb @@ -7,9 +7,9 @@ module Types class BuildNeedType < BaseObject graphql_name 'CiBuildNeed' - field :id, GraphQL::ID_TYPE, null: false, + field :id, GraphQL::Types::ID, null: false, description: 'ID of the job we need to complete.' - field :name, GraphQL::STRING_TYPE, null: true, + field :name, GraphQL::Types::String, null: true, description: 'Name of the job we need to complete.' end end diff --git a/app/graphql/types/ci/ci_cd_setting_type.rb b/app/graphql/types/ci/ci_cd_setting_type.rb index f90c75454ba..790deab8f68 100644 --- a/app/graphql/types/ci/ci_cd_setting_type.rb +++ b/app/graphql/types/ci/ci_cd_setting_type.rb @@ -7,16 +7,16 @@ module Types authorize :admin_project - field :merge_pipelines_enabled, GraphQL::BOOLEAN_TYPE, null: true, + field :merge_pipelines_enabled, GraphQL::Types::Boolean, null: true, description: 'Whether merge pipelines are enabled.', method: :merge_pipelines_enabled? - field :merge_trains_enabled, GraphQL::BOOLEAN_TYPE, null: true, + field :merge_trains_enabled, GraphQL::Types::Boolean, null: true, description: 'Whether merge trains are enabled.', method: :merge_trains_enabled? - field :keep_latest_artifact, GraphQL::BOOLEAN_TYPE, null: true, + field :keep_latest_artifact, GraphQL::Types::Boolean, null: true, description: 'Whether to keep the latest builds artifacts.', method: :keep_latest_artifacts_available? - field :job_token_scope_enabled, GraphQL::BOOLEAN_TYPE, null: true, + field :job_token_scope_enabled, GraphQL::Types::Boolean, null: true, description: 'Indicates CI job tokens generated in this project have restricted access to resources.', method: :job_token_scope_enabled? field :project, Types::ProjectType, null: true, diff --git a/app/graphql/types/ci/config/config_type.rb b/app/graphql/types/ci/config/config_type.rb index 88caf21c376..6ac21968bd4 100644 --- a/app/graphql/types/ci/config/config_type.rb +++ b/app/graphql/types/ci/config/config_type.rb @@ -7,9 +7,9 @@ module Types class ConfigType < BaseObject graphql_name 'CiConfig' - field :errors, [GraphQL::STRING_TYPE], null: true, + field :errors, [GraphQL::Types::String], null: true, description: 'Linting errors.' - field :merged_yaml, GraphQL::STRING_TYPE, null: true, + field :merged_yaml, GraphQL::Types::String, null: true, description: 'Merged CI configuration YAML.' field :stages, Types::Ci::Config::StageType.connection_type, null: true, description: 'Stages of the pipeline.' diff --git a/app/graphql/types/ci/config/group_type.rb b/app/graphql/types/ci/config/group_type.rb index 11be701e73f..e5cb0d4e72f 100644 --- a/app/graphql/types/ci/config/group_type.rb +++ b/app/graphql/types/ci/config/group_type.rb @@ -7,11 +7,11 @@ module Types class GroupType < BaseObject graphql_name 'CiConfigGroup' - field :name, GraphQL::STRING_TYPE, null: true, + field :name, GraphQL::Types::String, null: true, description: 'Name of the job group.' field :jobs, Types::Ci::Config::JobType.connection_type, null: true, description: 'Jobs in group.' - field :size, GraphQL::INT_TYPE, null: true, + field :size, GraphQL::Types::Int, null: true, description: 'Size of the job group.' end end diff --git a/app/graphql/types/ci/config/job_restriction_type.rb b/app/graphql/types/ci/config/job_restriction_type.rb index 294e3c94571..891ba18dacc 100644 --- a/app/graphql/types/ci/config/job_restriction_type.rb +++ b/app/graphql/types/ci/config/job_restriction_type.rb @@ -7,7 +7,7 @@ module Types class JobRestrictionType < BaseObject graphql_name 'CiConfigJobRestriction' - field :refs, [GraphQL::STRING_TYPE], null: true, + field :refs, [GraphQL::Types::String], null: true, description: 'The Git refs the job restriction applies to.' end end diff --git a/app/graphql/types/ci/config/job_type.rb b/app/graphql/types/ci/config/job_type.rb index 65fdc4c2615..4cf6780ef60 100644 --- a/app/graphql/types/ci/config/job_type.rb +++ b/app/graphql/types/ci/config/job_type.rb @@ -7,32 +7,32 @@ module Types class JobType < BaseObject graphql_name 'CiConfigJob' - field :name, GraphQL::STRING_TYPE, null: true, + field :name, GraphQL::Types::String, null: true, description: 'Name of the job.' - field :group_name, GraphQL::STRING_TYPE, null: true, + field :group_name, GraphQL::Types::String, null: true, description: 'Name of the job group.' - field :stage, GraphQL::STRING_TYPE, null: true, + field :stage, GraphQL::Types::String, null: true, description: 'Name of the job stage.' field :needs, Types::Ci::Config::NeedType.connection_type, null: true, description: 'Builds that must complete before the jobs run.' - field :allow_failure, GraphQL::BOOLEAN_TYPE, null: true, + field :allow_failure, GraphQL::Types::Boolean, null: true, description: 'Allow job to fail.' - field :before_script, [GraphQL::STRING_TYPE], null: true, + field :before_script, [GraphQL::Types::String], null: true, description: 'Override a set of commands that are executed before the job.' - field :script, [GraphQL::STRING_TYPE], null: true, + field :script, [GraphQL::Types::String], null: true, description: 'Shell script that is executed by a runner.' - field :after_script, [GraphQL::STRING_TYPE], null: true, + field :after_script, [GraphQL::Types::String], null: true, description: 'Override a set of commands that are executed after the job.' - field :when, GraphQL::STRING_TYPE, null: true, + field :when, GraphQL::Types::String, null: true, description: 'When to run the job.', resolver_method: :restrict_when_to_run_jobs - field :environment, GraphQL::STRING_TYPE, null: true, + field :environment, GraphQL::Types::String, null: true, description: 'Name of an environment to which the job deploys.' field :except, Types::Ci::Config::JobRestrictionType, null: true, description: 'Limit when jobs are not created.' field :only, Types::Ci::Config::JobRestrictionType, null: true, description: 'Jobs are created when these conditions do not apply.' - field :tags, [GraphQL::STRING_TYPE], null: true, + field :tags, [GraphQL::Types::String], null: true, description: 'List of tags that are used to select a runner.' def restrict_when_to_run_jobs diff --git a/app/graphql/types/ci/config/need_type.rb b/app/graphql/types/ci/config/need_type.rb index 01f73100409..6e9aea8eb64 100644 --- a/app/graphql/types/ci/config/need_type.rb +++ b/app/graphql/types/ci/config/need_type.rb @@ -7,7 +7,7 @@ module Types class NeedType < BaseObject graphql_name 'CiConfigNeed' - field :name, GraphQL::STRING_TYPE, null: true, + field :name, GraphQL::Types::String, null: true, description: 'Name of the need.' end end diff --git a/app/graphql/types/ci/config/stage_type.rb b/app/graphql/types/ci/config/stage_type.rb index 060efb7d45c..7e2aa9470f2 100644 --- a/app/graphql/types/ci/config/stage_type.rb +++ b/app/graphql/types/ci/config/stage_type.rb @@ -7,7 +7,7 @@ module Types class StageType < BaseObject graphql_name 'CiConfigStage' - field :name, GraphQL::STRING_TYPE, null: true, + field :name, GraphQL::Types::String, null: true, description: 'Name of the stage.' field :groups, Types::Ci::Config::GroupType.connection_type, null: true, description: 'Groups of jobs for the stage.' diff --git a/app/graphql/types/ci/detailed_status_type.rb b/app/graphql/types/ci/detailed_status_type.rb index 6310a62a103..4433e921971 100644 --- a/app/graphql/types/ci/detailed_status_type.rb +++ b/app/graphql/types/ci/detailed_status_type.rb @@ -6,26 +6,26 @@ module Types class DetailedStatusType < BaseObject graphql_name 'DetailedStatus' - field :id, GraphQL::STRING_TYPE, null: false, + field :id, GraphQL::Types::String, null: false, description: 'ID for a detailed status.', extras: [:parent] - field :group, GraphQL::STRING_TYPE, null: true, + field :group, GraphQL::Types::String, null: true, description: 'Group of the status.' - field :icon, GraphQL::STRING_TYPE, null: true, + field :icon, GraphQL::Types::String, null: true, description: 'Icon of the status.' - field :favicon, GraphQL::STRING_TYPE, null: true, + field :favicon, GraphQL::Types::String, null: true, description: 'Favicon of the status.' - field :details_path, GraphQL::STRING_TYPE, null: true, + field :details_path, GraphQL::Types::String, null: true, description: 'Path of the details for the status.' - field :has_details, GraphQL::BOOLEAN_TYPE, null: true, + field :has_details, GraphQL::Types::Boolean, null: true, description: 'Indicates if the status has further details.', method: :has_details? - field :label, GraphQL::STRING_TYPE, null: true, + field :label, GraphQL::Types::String, null: true, calls_gitaly: true, description: 'Label of the status.' - field :text, GraphQL::STRING_TYPE, null: true, + field :text, GraphQL::Types::String, null: true, description: 'Text of the status.' - field :tooltip, GraphQL::STRING_TYPE, null: true, + field :tooltip, GraphQL::Types::String, null: true, description: 'Tooltip associated with the status.', method: :status_tooltip field :action, Types::Ci::StatusActionType, null: true, diff --git a/app/graphql/types/ci/group_type.rb b/app/graphql/types/ci/group_type.rb index 3da183cb842..3ae23ba9bd4 100644 --- a/app/graphql/types/ci/group_type.rb +++ b/app/graphql/types/ci/group_type.rb @@ -6,11 +6,11 @@ module Types class GroupType < BaseObject graphql_name 'CiGroup' - field :id, GraphQL::STRING_TYPE, null: false, + field :id, GraphQL::Types::String, null: false, description: 'ID for a group.' - field :name, GraphQL::STRING_TYPE, null: true, + field :name, GraphQL::Types::String, null: true, description: 'Name of the job group.' - field :size, GraphQL::INT_TYPE, null: true, + field :size, GraphQL::Types::Int, null: true, description: 'Size of the group.' field :jobs, Ci::JobType.connection_type, null: true, description: 'Jobs in group.' diff --git a/app/graphql/types/ci/job_artifact_type.rb b/app/graphql/types/ci/job_artifact_type.rb index 7dc93041b53..f80681bcf36 100644 --- a/app/graphql/types/ci/job_artifact_type.rb +++ b/app/graphql/types/ci/job_artifact_type.rb @@ -6,7 +6,7 @@ module Types class JobArtifactType < BaseObject graphql_name 'CiJobArtifact' - field :download_path, GraphQL::STRING_TYPE, null: true, + field :download_path, GraphQL::Types::String, null: true, description: "URL for downloading the artifact's file." field :file_type, ::Types::Ci::JobArtifactFileTypeEnum, null: true, diff --git a/app/graphql/types/ci/job_type.rb b/app/graphql/types/ci/job_type.rb index 360ea3ba7a9..4a3518e1865 100644 --- a/app/graphql/types/ci/job_type.rb +++ b/app/graphql/types/ci/job_type.rb @@ -14,7 +14,7 @@ module Types description: 'ID of the job.' field :pipeline, Types::Ci::PipelineType, null: true, description: 'Pipeline the job belongs to.' - field :name, GraphQL::STRING_TYPE, null: true, + field :name, GraphQL::Types::String, null: true, description: 'Name of the job.' field :needs, BuildNeedType.connection_type, null: true, description: 'References to builds that must complete before the jobs run.' @@ -24,11 +24,11 @@ module Types description: "Status of the job." field :stage, Types::Ci::StageType, null: true, description: 'Stage of the job.' - field :allow_failure, ::GraphQL::BOOLEAN_TYPE, null: false, + field :allow_failure, ::GraphQL::Types::Boolean, null: false, description: 'Whether the job is allowed to fail.' - field :duration, GraphQL::INT_TYPE, null: true, + field :duration, GraphQL::Types::Int, null: true, description: 'Duration of the job in seconds.' - field :tags, [GraphQL::STRING_TYPE], null: true, + field :tags, [GraphQL::Types::String], null: true, description: 'Tags for the current job.' # Life-cycle timestamps: @@ -53,33 +53,33 @@ module Types description: 'Detailed status of the job.' field :artifacts, Types::Ci::JobArtifactType.connection_type, null: true, description: 'Artifacts generated by the job.' - field :short_sha, type: GraphQL::STRING_TYPE, null: false, + field :short_sha, type: GraphQL::Types::String, null: false, description: 'Short SHA1 ID of the commit.' - field :scheduling_type, GraphQL::STRING_TYPE, null: true, + field :scheduling_type, GraphQL::Types::String, null: true, description: 'Type of job scheduling. Value is `dag` if the job uses the `needs` keyword, and `stage` otherwise.' - field :commit_path, GraphQL::STRING_TYPE, null: true, + field :commit_path, GraphQL::Types::String, null: true, description: 'Path to the commit that triggered the job.' - field :ref_name, GraphQL::STRING_TYPE, null: true, + field :ref_name, GraphQL::Types::String, null: true, description: 'Ref name of the job.' - field :ref_path, GraphQL::STRING_TYPE, null: true, + field :ref_path, GraphQL::Types::String, null: true, description: 'Path to the ref.' - field :playable, GraphQL::BOOLEAN_TYPE, null: false, method: :playable?, + field :playable, GraphQL::Types::Boolean, null: false, method: :playable?, description: 'Indicates the job can be played.' - field :retryable, GraphQL::BOOLEAN_TYPE, null: false, method: :retryable?, + field :retryable, GraphQL::Types::Boolean, null: false, method: :retryable?, description: 'Indicates the job can be retried.' - field :cancelable, GraphQL::BOOLEAN_TYPE, null: false, method: :cancelable?, + field :cancelable, GraphQL::Types::Boolean, null: false, method: :cancelable?, description: 'Indicates the job can be canceled.' - field :active, GraphQL::BOOLEAN_TYPE, null: false, method: :active?, + field :active, GraphQL::Types::Boolean, null: false, method: :active?, description: 'Indicates the job is active.' - field :stuck, GraphQL::BOOLEAN_TYPE, null: false, method: :stuck?, + field :stuck, GraphQL::Types::Boolean, null: false, method: :stuck?, description: 'Indicates the job is stuck.' field :coverage, GraphQL::FLOAT_TYPE, null: true, description: 'Coverage level of the job.' - field :created_by_tag, GraphQL::BOOLEAN_TYPE, null: false, + field :created_by_tag, GraphQL::Types::Boolean, null: false, description: 'Whether the job was created by a tag.' - field :manual_job, GraphQL::BOOLEAN_TYPE, null: true, + field :manual_job, GraphQL::Types::Boolean, null: true, description: 'Whether the job has a manual action.' - field :triggered, GraphQL::BOOLEAN_TYPE, null: true, + field :triggered, GraphQL::Types::Boolean, null: true, description: 'Whether the job was triggered.' def pipeline diff --git a/app/graphql/types/ci/pipeline_type.rb b/app/graphql/types/ci/pipeline_type.rb index f4a6c18f73e..0375257eb7b 100644 --- a/app/graphql/types/ci/pipeline_type.rb +++ b/app/graphql/types/ci/pipeline_type.rb @@ -12,25 +12,25 @@ module Types expose_permissions Types::PermissionTypes::Ci::Pipeline - field :id, GraphQL::ID_TYPE, null: false, + field :id, GraphQL::Types::ID, null: false, description: 'ID of the pipeline.' - field :iid, GraphQL::STRING_TYPE, null: false, + field :iid, GraphQL::Types::String, null: false, description: 'Internal ID of the pipeline.' - field :sha, GraphQL::STRING_TYPE, null: false, + field :sha, GraphQL::Types::String, null: false, description: "SHA of the pipeline's commit." - field :before_sha, GraphQL::STRING_TYPE, null: true, + field :before_sha, GraphQL::Types::String, null: true, description: 'Base SHA of the source branch.' - field :complete, GraphQL::BOOLEAN_TYPE, null: false, method: :complete?, + field :complete, GraphQL::Types::Boolean, null: false, method: :complete?, description: 'Indicates if a pipeline is complete.' field :status, PipelineStatusEnum, null: false, description: "Status of the pipeline (#{::Ci::Pipeline.all_state_names.compact.join(', ').upcase})" - field :warnings, GraphQL::BOOLEAN_TYPE, null: false, method: :has_warnings?, + field :warnings, GraphQL::Types::Boolean, null: false, method: :has_warnings?, description: "Indicates if a pipeline has warnings." field :detailed_status, Types::Ci::DetailedStatusType, null: false, @@ -39,7 +39,7 @@ module Types field :config_source, PipelineConfigSourceEnum, null: true, description: "Configuration source of the pipeline (#{::Enums::Ci::Pipeline.config_sources.keys.join(', ').upcase})" - field :duration, GraphQL::INT_TYPE, null: true, + field :duration, GraphQL::Types::Int, null: true, description: 'Duration of the pipeline in seconds.' field :queued_duration, Types::DurationType, null: true, @@ -76,12 +76,12 @@ module Types null: true, description: 'Pipeline user.' - field :retryable, GraphQL::BOOLEAN_TYPE, + field :retryable, GraphQL::Types::Boolean, description: 'Specifies if a pipeline can be retried.', method: :retryable?, null: false - field :cancelable, GraphQL::BOOLEAN_TYPE, + field :cancelable, GraphQL::Types::Boolean, description: 'Specifies if a pipeline can be canceled.', method: :cancelable?, null: false @@ -103,7 +103,7 @@ module Types required: false, description: 'ID of the job.' argument :name, - type: ::GraphQL::STRING_TYPE, + type: ::GraphQL::Types::String, required: false, description: 'Name of the job.' end @@ -122,19 +122,19 @@ module Types description: 'Pipeline that triggered the pipeline.', method: :triggered_by_pipeline - field :path, GraphQL::STRING_TYPE, null: true, + field :path, GraphQL::Types::String, null: true, description: "Relative path to the pipeline's page." - field :commit_path, GraphQL::STRING_TYPE, null: true, + field :commit_path, GraphQL::Types::String, null: true, description: 'Path to the commit that triggered the pipeline.' field :project, Types::ProjectType, null: true, description: 'Project the pipeline belongs to.' - field :active, GraphQL::BOOLEAN_TYPE, null: false, method: :active?, + field :active, GraphQL::Types::Boolean, null: false, method: :active?, description: 'Indicates if the pipeline is active.' - field :uses_needs, GraphQL::BOOLEAN_TYPE, null: true, + field :uses_needs, GraphQL::Types::Boolean, null: true, method: :uses_needs?, description: 'Indicates if the pipeline has jobs with `needs` dependencies.' @@ -150,7 +150,7 @@ module Types description: 'A specific test suite in a pipeline test report.', resolver: Resolvers::Ci::TestSuiteResolver - field :ref, GraphQL::STRING_TYPE, null: true, + field :ref, GraphQL::Types::String, null: true, description: 'Reference to the branch from which the pipeline was triggered.' def detailed_status diff --git a/app/graphql/types/ci/recent_failures_type.rb b/app/graphql/types/ci/recent_failures_type.rb index eeff7222762..f56b0939086 100644 --- a/app/graphql/types/ci/recent_failures_type.rb +++ b/app/graphql/types/ci/recent_failures_type.rb @@ -9,10 +9,10 @@ module Types connection_type_class(Types::CountableConnectionType) - field :count, GraphQL::INT_TYPE, null: true, + field :count, GraphQL::Types::Int, null: true, description: 'Number of times the test case has failed in the past 14 days.' - field :base_branch, GraphQL::STRING_TYPE, null: true, + field :base_branch, GraphQL::Types::String, null: true, description: 'Name of the base branch of the project.' end # rubocop: enable Graphql/AuthorizeTypes diff --git a/app/graphql/types/ci/runner_architecture_type.rb b/app/graphql/types/ci/runner_architecture_type.rb index 229974d4d13..08d3f98592b 100644 --- a/app/graphql/types/ci/runner_architecture_type.rb +++ b/app/graphql/types/ci/runner_architecture_type.rb @@ -6,9 +6,9 @@ module Types class RunnerArchitectureType < BaseObject graphql_name 'RunnerArchitecture' - field :name, GraphQL::STRING_TYPE, null: false, + field :name, GraphQL::Types::String, null: false, description: 'Name of the runner platform architecture.' - field :download_location, GraphQL::STRING_TYPE, null: false, + field :download_location, GraphQL::Types::String, null: false, description: 'Download location for the runner for the platform architecture.' end end diff --git a/app/graphql/types/ci/runner_platform_type.rb b/app/graphql/types/ci/runner_platform_type.rb index 5636f88835e..ffcf6364968 100644 --- a/app/graphql/types/ci/runner_platform_type.rb +++ b/app/graphql/types/ci/runner_platform_type.rb @@ -6,9 +6,9 @@ module Types class RunnerPlatformType < BaseObject graphql_name 'RunnerPlatform' - field :name, GraphQL::STRING_TYPE, null: false, + field :name, GraphQL::Types::String, null: false, description: 'Name slug of the runner platform.' - field :human_readable_name, GraphQL::STRING_TYPE, null: false, + field :human_readable_name, GraphQL::Types::String, null: false, description: 'Human readable name of the runner platform.' field :architectures, Types::Ci::RunnerArchitectureType.connection_type, null: true, description: 'Runner architectures supported for the platform.' diff --git a/app/graphql/types/ci/runner_setup_type.rb b/app/graphql/types/ci/runner_setup_type.rb index 61a2ea2a411..70f33cef8ad 100644 --- a/app/graphql/types/ci/runner_setup_type.rb +++ b/app/graphql/types/ci/runner_setup_type.rb @@ -6,9 +6,9 @@ module Types class RunnerSetupType < BaseObject graphql_name 'RunnerSetup' - field :install_instructions, GraphQL::STRING_TYPE, null: false, + field :install_instructions, GraphQL::Types::String, null: false, description: 'Instructions for installing the runner on the specified architecture.' - field :register_instructions, GraphQL::STRING_TYPE, null: true, + field :register_instructions, GraphQL::Types::String, null: true, description: 'Instructions for registering the runner.' end end diff --git a/app/graphql/types/ci/runner_type.rb b/app/graphql/types/ci/runner_type.rb index 9c5041b0860..e2c8070af0c 100644 --- a/app/graphql/types/ci/runner_type.rb +++ b/app/graphql/types/ci/runner_type.rb @@ -5,6 +5,7 @@ module Types class RunnerType < BaseObject graphql_name 'CiRunner' authorize :read_runner + present_using ::Ci::RunnerPresenter JOB_COUNT_LIMIT = 1000 @@ -12,38 +13,38 @@ module Types field :id, ::Types::GlobalIDType[::Ci::Runner], null: false, description: 'ID of the runner.' - field :description, GraphQL::STRING_TYPE, null: true, + field :description, GraphQL::Types::String, null: true, description: 'Description of the runner.' field :contacted_at, Types::TimeType, null: true, description: 'Last contact from the runner.', method: :contacted_at - field :maximum_timeout, GraphQL::INT_TYPE, null: true, + field :maximum_timeout, GraphQL::Types::Int, null: true, description: 'Maximum timeout (in seconds) for jobs processed by the runner.' field :access_level, ::Types::Ci::RunnerAccessLevelEnum, null: false, description: 'Access level of the runner.' - field :active, GraphQL::BOOLEAN_TYPE, null: false, + field :active, GraphQL::Types::Boolean, null: false, description: 'Indicates the runner is allowed to receive jobs.' field :status, ::Types::Ci::RunnerStatusEnum, null: false, description: 'Status of the runner.' - field :version, GraphQL::STRING_TYPE, null: true, + field :version, GraphQL::Types::String, null: true, description: 'Version of the runner.' - field :short_sha, GraphQL::STRING_TYPE, null: true, + field :short_sha, GraphQL::Types::String, null: true, description: %q(First eight characters of the runner's token used to authenticate new job requests. Used as the runner's unique ID.) - field :revision, GraphQL::STRING_TYPE, null: true, + field :revision, GraphQL::Types::String, null: true, description: 'Revision of the runner.' - field :locked, GraphQL::BOOLEAN_TYPE, null: true, + field :locked, GraphQL::Types::Boolean, null: true, description: 'Indicates the runner is locked.' - field :run_untagged, GraphQL::BOOLEAN_TYPE, null: false, + field :run_untagged, GraphQL::Types::Boolean, null: false, description: 'Indicates the runner is able to run untagged jobs.' - field :ip_address, GraphQL::STRING_TYPE, null: true, + field :ip_address, GraphQL::Types::String, null: true, description: 'IP address of the runner.' field :runner_type, ::Types::Ci::RunnerTypeEnum, null: false, description: 'Type of the runner.' - field :tag_list, [GraphQL::STRING_TYPE], null: true, + field :tag_list, [GraphQL::Types::String], null: true, description: 'Tags associated with the runner.' - field :project_count, GraphQL::INT_TYPE, null: true, + field :project_count, GraphQL::Types::Int, null: true, description: 'Number of projects that the runner is associated with.' - field :job_count, GraphQL::INT_TYPE, null: true, + field :job_count, GraphQL::Types::Int, null: true, description: "Number of jobs processed by the runner (limited to #{JOB_COUNT_LIMIT}, plus one to indicate that more items exist)." def job_count diff --git a/app/graphql/types/ci/stage_type.rb b/app/graphql/types/ci/stage_type.rb index ce3edb6c54f..63357e2345b 100644 --- a/app/graphql/types/ci/stage_type.rb +++ b/app/graphql/types/ci/stage_type.rb @@ -6,9 +6,9 @@ module Types graphql_name 'CiStage' authorize :read_commit_status - field :id, GraphQL::ID_TYPE, null: false, + field :id, GraphQL::Types::ID, null: false, description: 'ID of the stage.' - field :name, type: GraphQL::STRING_TYPE, null: true, + field :name, type: GraphQL::Types::String, null: true, description: 'Name of the stage.' field :groups, type: Ci::GroupType.connection_type, null: true, extras: [:lookahead], @@ -18,7 +18,7 @@ module Types field :jobs, Ci::JobType.connection_type, null: true, description: 'Jobs for the stage.', method: 'latest_statuses' - field :status, GraphQL::STRING_TYPE, + field :status, GraphQL::Types::String, null: true, description: 'Status of the pipeline stage.' @@ -52,9 +52,13 @@ module Types # rubocop: disable CodeReuse/ActiveRecord def jobs_for_pipeline(pipeline, stage_ids, include_needs) - results = pipeline.latest_statuses.where(stage_id: stage_ids) - results = results.preload(:project) - results = results.preload(:needs) if include_needs + builds_results = pipeline.latest_builds.where(stage_id: stage_ids).preload(:job_artifacts, :project) + bridges_results = pipeline.bridges.where(stage_id: stage_ids).preload(:project) + builds_results = builds_results.preload(:needs) if include_needs + bridges_results = bridges_results.preload(:needs) if include_needs + commit_status_results = pipeline.latest_statuses.where(stage_id: stage_ids) + + results = builds_results | bridges_results | commit_status_results results.group_by(&:stage_id) end diff --git a/app/graphql/types/ci/status_action_type.rb b/app/graphql/types/ci/status_action_type.rb index a06b09735b3..15e5344e130 100644 --- a/app/graphql/types/ci/status_action_type.rb +++ b/app/graphql/types/ci/status_action_type.rb @@ -5,19 +5,19 @@ module Types class StatusActionType < BaseObject graphql_name 'StatusAction' - field :id, GraphQL::STRING_TYPE, null: false, + field :id, GraphQL::Types::String, null: false, description: 'ID for a status action.', extras: [:parent] - field :button_title, GraphQL::STRING_TYPE, null: true, + field :button_title, GraphQL::Types::String, null: true, description: 'Title for the button, for example: Retry this job.' - field :icon, GraphQL::STRING_TYPE, null: true, + field :icon, GraphQL::Types::String, null: true, description: 'Icon used in the action button.' - field :method, GraphQL::STRING_TYPE, null: true, + field :method, GraphQL::Types::String, null: true, description: 'Method for the action, for example: :post.', resolver_method: :action_method - field :path, GraphQL::STRING_TYPE, null: true, + field :path, GraphQL::Types::String, null: true, description: 'Path for the action.' - field :title, GraphQL::STRING_TYPE, null: true, + field :title, GraphQL::Types::String, null: true, description: 'Title for the action, for example: Retry.' def id(parent:) diff --git a/app/graphql/types/ci/template_type.rb b/app/graphql/types/ci/template_type.rb index 5f07fa16928..7e7ee44025f 100644 --- a/app/graphql/types/ci/template_type.rb +++ b/app/graphql/types/ci/template_type.rb @@ -7,9 +7,9 @@ module Types graphql_name 'CiTemplate' description 'GitLab CI/CD configuration template.' - field :name, GraphQL::STRING_TYPE, null: false, + field :name, GraphQL::Types::String, null: false, description: 'Name of the CI template.' - field :content, GraphQL::STRING_TYPE, null: false, + field :content, GraphQL::Types::String, null: false, description: 'Contents of the CI template.' end end diff --git a/app/graphql/types/ci/test_case_type.rb b/app/graphql/types/ci/test_case_type.rb index 9cc3f918125..9ec5daa44ea 100644 --- a/app/graphql/types/ci/test_case_type.rb +++ b/app/graphql/types/ci/test_case_type.rb @@ -12,25 +12,25 @@ module Types field :status, Types::Ci::TestCaseStatusEnum, null: true, description: "Status of the test case (#{::Gitlab::Ci::Reports::TestCase::STATUS_TYPES.join(', ')})." - field :name, GraphQL::STRING_TYPE, null: true, + field :name, GraphQL::Types::String, null: true, description: 'Name of the test case.' - field :classname, GraphQL::STRING_TYPE, null: true, + field :classname, GraphQL::Types::String, null: true, description: 'Classname of the test case.' field :execution_time, GraphQL::FLOAT_TYPE, null: true, description: 'Test case execution time in seconds.' - field :file, GraphQL::STRING_TYPE, null: true, + field :file, GraphQL::Types::String, null: true, description: 'Path to the file of the test case.' - field :attachment_url, GraphQL::STRING_TYPE, null: true, + field :attachment_url, GraphQL::Types::String, null: true, description: 'URL of the test case attachment file.' - field :system_output, GraphQL::STRING_TYPE, null: true, + field :system_output, GraphQL::Types::String, null: true, description: 'System output of the test case.' - field :stack_trace, GraphQL::STRING_TYPE, null: true, + field :stack_trace, GraphQL::Types::String, null: true, description: 'Stack trace of the test case.' field :recent_failures, Types::Ci::RecentFailuresType, null: true, diff --git a/app/graphql/types/ci/test_report_total_type.rb b/app/graphql/types/ci/test_report_total_type.rb index 1123734adc3..aa07a391519 100644 --- a/app/graphql/types/ci/test_report_total_type.rb +++ b/app/graphql/types/ci/test_report_total_type.rb @@ -10,22 +10,22 @@ module Types field :time, GraphQL::FLOAT_TYPE, null: true, description: 'Total duration of the tests.' - field :count, GraphQL::INT_TYPE, null: true, + field :count, GraphQL::Types::Int, null: true, description: 'Total number of the test cases.' - field :success, GraphQL::INT_TYPE, null: true, + field :success, GraphQL::Types::Int, null: true, description: 'Total number of test cases that succeeded.' - field :failed, GraphQL::INT_TYPE, null: true, + field :failed, GraphQL::Types::Int, null: true, description: 'Total number of test cases that failed.' - field :skipped, GraphQL::INT_TYPE, null: true, + field :skipped, GraphQL::Types::Int, null: true, description: 'Total number of test cases that were skipped.' - field :error, GraphQL::INT_TYPE, null: true, + field :error, GraphQL::Types::Int, null: true, description: 'Total number of test cases that had an error.' - field :suite_error, GraphQL::STRING_TYPE, null: true, + field :suite_error, GraphQL::Types::String, null: true, description: 'Test suite error message.' end # rubocop: enable Graphql/AuthorizeTypes diff --git a/app/graphql/types/ci/test_suite_summary_type.rb b/app/graphql/types/ci/test_suite_summary_type.rb index a80a9179cb4..3db2d80d591 100644 --- a/app/graphql/types/ci/test_suite_summary_type.rb +++ b/app/graphql/types/ci/test_suite_summary_type.rb @@ -9,31 +9,31 @@ module Types connection_type_class(Types::CountableConnectionType) - field :name, GraphQL::STRING_TYPE, null: true, + field :name, GraphQL::Types::String, null: true, description: 'Name of the test suite.' field :total_time, GraphQL::FLOAT_TYPE, null: true, description: 'Total duration of the tests in the test suite.' - field :total_count, GraphQL::INT_TYPE, null: true, + field :total_count, GraphQL::Types::Int, null: true, description: 'Total number of the test cases in the test suite.' - field :success_count, GraphQL::INT_TYPE, null: true, + field :success_count, GraphQL::Types::Int, null: true, description: 'Total number of test cases that succeeded in the test suite.' - field :failed_count, GraphQL::INT_TYPE, null: true, + field :failed_count, GraphQL::Types::Int, null: true, description: 'Total number of test cases that failed in the test suite.' - field :skipped_count, GraphQL::INT_TYPE, null: true, + field :skipped_count, GraphQL::Types::Int, null: true, description: 'Total number of test cases that were skipped in the test suite.' - field :error_count, GraphQL::INT_TYPE, null: true, + field :error_count, GraphQL::Types::Int, null: true, description: 'Total number of test cases that had an error.' - field :suite_error, GraphQL::STRING_TYPE, null: true, + field :suite_error, GraphQL::Types::String, null: true, description: 'Test suite error message.' - field :build_ids, [GraphQL::ID_TYPE], null: true, + field :build_ids, [GraphQL::Types::ID], null: true, description: 'IDs of the builds used to run the test suite.' end # rubocop: enable Graphql/AuthorizeTypes diff --git a/app/graphql/types/ci/test_suite_type.rb b/app/graphql/types/ci/test_suite_type.rb index 7d4c01da81b..f9f37d4045e 100644 --- a/app/graphql/types/ci/test_suite_type.rb +++ b/app/graphql/types/ci/test_suite_type.rb @@ -9,28 +9,28 @@ module Types connection_type_class(Types::CountableConnectionType) - field :name, GraphQL::STRING_TYPE, null: true, + field :name, GraphQL::Types::String, null: true, description: 'Name of the test suite.' field :total_time, GraphQL::FLOAT_TYPE, null: true, description: 'Total duration of the tests in the test suite.' - field :total_count, GraphQL::INT_TYPE, null: true, + field :total_count, GraphQL::Types::Int, null: true, description: 'Total number of the test cases in the test suite.' - field :success_count, GraphQL::INT_TYPE, null: true, + field :success_count, GraphQL::Types::Int, null: true, description: 'Total number of test cases that succeeded in the test suite.' - field :failed_count, GraphQL::INT_TYPE, null: true, + field :failed_count, GraphQL::Types::Int, null: true, description: 'Total number of test cases that failed in the test suite.' - field :skipped_count, GraphQL::INT_TYPE, null: true, + field :skipped_count, GraphQL::Types::Int, null: true, description: 'Total number of test cases that were skipped in the test suite.' - field :error_count, GraphQL::INT_TYPE, null: true, + field :error_count, GraphQL::Types::Int, null: true, description: 'Total number of test cases that had an error.' - field :suite_error, GraphQL::STRING_TYPE, null: true, + field :suite_error, GraphQL::Types::String, null: true, description: 'Test suite error message.' field :test_cases, Types::Ci::TestCaseType.connection_type, null: true, diff --git a/app/graphql/types/ci_configuration/sast/analyzers_entity_input_type.rb b/app/graphql/types/ci_configuration/sast/analyzers_entity_input_type.rb index ccb72283cf6..68b9a63d8dc 100644 --- a/app/graphql/types/ci_configuration/sast/analyzers_entity_input_type.rb +++ b/app/graphql/types/ci_configuration/sast/analyzers_entity_input_type.rb @@ -7,10 +7,10 @@ module Types graphql_name 'SastCiConfigurationAnalyzersEntityInput' description 'Represents the analyzers entity in SAST CI configuration' - argument :name, GraphQL::STRING_TYPE, required: true, + argument :name, GraphQL::Types::String, required: true, description: 'Name of analyzer.' - argument :enabled, GraphQL::BOOLEAN_TYPE, required: true, + argument :enabled, GraphQL::Types::Boolean, required: true, description: 'State of the analyzer.' argument :variables, [::Types::CiConfiguration::Sast::EntityInputType], diff --git a/app/graphql/types/ci_configuration/sast/analyzers_entity_type.rb b/app/graphql/types/ci_configuration/sast/analyzers_entity_type.rb index 3c6202ca7e0..9fdc7c1b000 100644 --- a/app/graphql/types/ci_configuration/sast/analyzers_entity_type.rb +++ b/app/graphql/types/ci_configuration/sast/analyzers_entity_type.rb @@ -8,16 +8,16 @@ module Types graphql_name 'SastCiConfigurationAnalyzersEntity' description 'Represents an analyzer entity in SAST CI configuration' - field :name, GraphQL::STRING_TYPE, null: true, + field :name, GraphQL::Types::String, null: true, description: 'Name of the analyzer.' - field :label, GraphQL::STRING_TYPE, null: true, + field :label, GraphQL::Types::String, null: true, description: 'Analyzer label used in the config UI.' - field :enabled, GraphQL::BOOLEAN_TYPE, null: true, + field :enabled, GraphQL::Types::Boolean, null: true, description: 'Indicates whether an analyzer is enabled.' - field :description, GraphQL::STRING_TYPE, null: true, + field :description, GraphQL::Types::String, null: true, description: 'Analyzer description that is displayed on the form.' field :variables, ::Types::CiConfiguration::Sast::EntityType.connection_type, null: true, diff --git a/app/graphql/types/ci_configuration/sast/entity_input_type.rb b/app/graphql/types/ci_configuration/sast/entity_input_type.rb index 9fce120889b..f0e3c07d71f 100644 --- a/app/graphql/types/ci_configuration/sast/entity_input_type.rb +++ b/app/graphql/types/ci_configuration/sast/entity_input_type.rb @@ -7,13 +7,13 @@ module Types graphql_name 'SastCiConfigurationEntityInput' description 'Represents an entity in SAST CI configuration' - argument :field, GraphQL::STRING_TYPE, required: true, + argument :field, GraphQL::Types::String, required: true, description: 'CI keyword of entity.' - argument :default_value, GraphQL::STRING_TYPE, required: true, + argument :default_value, GraphQL::Types::String, required: true, description: 'Default value that is used if value is empty.' - argument :value, GraphQL::STRING_TYPE, required: true, + argument :value, GraphQL::Types::String, required: true, description: 'Current value of the entity.' end end diff --git a/app/graphql/types/ci_configuration/sast/entity_type.rb b/app/graphql/types/ci_configuration/sast/entity_type.rb index eeb9025391f..41b8575d99a 100644 --- a/app/graphql/types/ci_configuration/sast/entity_type.rb +++ b/app/graphql/types/ci_configuration/sast/entity_type.rb @@ -8,25 +8,25 @@ module Types graphql_name 'SastCiConfigurationEntity' description 'Represents an entity in SAST CI configuration' - field :field, GraphQL::STRING_TYPE, null: true, + field :field, GraphQL::Types::String, null: true, description: 'CI keyword of entity.' - field :label, GraphQL::STRING_TYPE, null: true, + field :label, GraphQL::Types::String, null: true, description: 'Label for entity used in the form.' - field :type, GraphQL::STRING_TYPE, null: true, + field :type, GraphQL::Types::String, null: true, description: 'Type of the field value.' field :options, ::Types::CiConfiguration::Sast::OptionsEntityType.connection_type, null: true, description: 'Different possible values of the field.' - field :default_value, GraphQL::STRING_TYPE, null: true, + field :default_value, GraphQL::Types::String, null: true, description: 'Default value that is used if value is empty.' - field :description, GraphQL::STRING_TYPE, null: true, + field :description, GraphQL::Types::String, null: true, description: 'Entity description that is displayed on the form.' - field :value, GraphQL::STRING_TYPE, null: true, + field :value, GraphQL::Types::String, null: true, description: 'Current value of the entity.' field :size, ::Types::CiConfiguration::Sast::UiComponentSizeEnum, null: true, diff --git a/app/graphql/types/ci_configuration/sast/options_entity_type.rb b/app/graphql/types/ci_configuration/sast/options_entity_type.rb index 86d104a7fda..5f365807cfe 100644 --- a/app/graphql/types/ci_configuration/sast/options_entity_type.rb +++ b/app/graphql/types/ci_configuration/sast/options_entity_type.rb @@ -8,10 +8,10 @@ module Types graphql_name 'SastCiConfigurationOptionsEntity' description 'Represents an entity for options in SAST CI configuration' - field :label, GraphQL::STRING_TYPE, null: true, + field :label, GraphQL::Types::String, null: true, description: 'Label of option entity.' - field :value, GraphQL::STRING_TYPE, null: true, + field :value, GraphQL::Types::String, null: true, description: 'Value of option entity.' end end diff --git a/app/graphql/types/commit_action_type.rb b/app/graphql/types/commit_action_type.rb index cc1f45478e4..b170134b388 100644 --- a/app/graphql/types/commit_action_type.rb +++ b/app/graphql/types/commit_action_type.rb @@ -4,15 +4,15 @@ module Types class CommitActionType < BaseInputObject argument :action, type: Types::CommitActionModeEnum, required: true, description: 'The action to perform, create, delete, move, update, chmod.' - argument :file_path, type: GraphQL::STRING_TYPE, required: true, + argument :file_path, type: GraphQL::Types::String, required: true, description: 'Full path to the file.' - argument :content, type: GraphQL::STRING_TYPE, required: false, + argument :content, type: GraphQL::Types::String, required: false, description: 'Content of the file.' - argument :previous_path, type: GraphQL::STRING_TYPE, required: false, + argument :previous_path, type: GraphQL::Types::String, required: false, description: 'Original full path to the file being moved.' - argument :last_commit_id, type: GraphQL::STRING_TYPE, required: false, + argument :last_commit_id, type: GraphQL::Types::String, required: false, description: 'Last known file commit ID.' - argument :execute_filemode, type: GraphQL::BOOLEAN_TYPE, required: false, + argument :execute_filemode, type: GraphQL::Types::Boolean, required: false, description: 'Enables/disables the execute flag on the file.' argument :encoding, type: Types::CommitEncodingEnum, required: false, description: 'Encoding of the file. Default is text.' diff --git a/app/graphql/types/commit_type.rb b/app/graphql/types/commit_type.rb index d137901380b..dc1bf6a3101 100644 --- a/app/graphql/types/commit_type.rb +++ b/app/graphql/types/commit_type.rb @@ -8,31 +8,31 @@ module Types present_using CommitPresenter - field :id, type: GraphQL::ID_TYPE, null: false, + field :id, type: GraphQL::Types::ID, null: false, description: 'ID (global ID) of the commit.' - field :sha, type: GraphQL::STRING_TYPE, null: false, + field :sha, type: GraphQL::Types::String, null: false, description: 'SHA1 ID of the commit.' - field :short_id, type: GraphQL::STRING_TYPE, null: false, + field :short_id, type: GraphQL::Types::String, null: false, description: 'Short SHA1 ID of the commit.' - field :title, type: GraphQL::STRING_TYPE, null: true, calls_gitaly: true, + field :title, type: GraphQL::Types::String, null: true, calls_gitaly: true, description: 'Title of the commit message.' markdown_field :title_html, null: true - field :description, type: GraphQL::STRING_TYPE, null: true, + field :description, type: GraphQL::Types::String, null: true, description: 'Description of the commit message.' markdown_field :description_html, null: true - field :message, type: GraphQL::STRING_TYPE, null: true, + field :message, type: GraphQL::Types::String, null: true, description: 'Raw commit message.' field :authored_date, type: Types::TimeType, null: true, description: 'Timestamp of when the commit was authored.' - field :web_url, type: GraphQL::STRING_TYPE, null: false, + field :web_url, type: GraphQL::Types::String, null: false, description: 'Web URL of the commit.' - field :web_path, type: GraphQL::STRING_TYPE, null: false, + field :web_path, type: GraphQL::Types::String, null: false, description: 'Web path of the commit.' - field :signature_html, type: GraphQL::STRING_TYPE, null: true, calls_gitaly: true, + field :signature_html, type: GraphQL::Types::String, null: true, calls_gitaly: true, description: 'Rendered HTML of the commit signature.' - field :author_name, type: GraphQL::STRING_TYPE, null: true, + field :author_name, type: GraphQL::Types::String, null: true, description: 'Commit authors name.' - field :author_gravatar, type: GraphQL::STRING_TYPE, null: true, + field :author_gravatar, type: GraphQL::Types::String, null: true, description: 'Commit authors gravatar.' # models/commit lazy loads the author by email diff --git a/app/graphql/types/container_expiration_policy_type.rb b/app/graphql/types/container_expiration_policy_type.rb index 2b01474617a..6d6df21fe3f 100644 --- a/app/graphql/types/container_expiration_policy_type.rb +++ b/app/graphql/types/container_expiration_policy_type.rb @@ -10,7 +10,7 @@ module Types field :created_at, Types::TimeType, null: false, description: 'Timestamp of when the container expiration policy was created.' field :updated_at, Types::TimeType, null: false, description: 'Timestamp of when the container expiration policy was updated.' - field :enabled, GraphQL::BOOLEAN_TYPE, null: false, description: 'Indicates whether this container expiration policy is enabled.' + field :enabled, GraphQL::Types::Boolean, null: false, description: 'Indicates whether this container expiration policy is enabled.' field :older_than, Types::ContainerExpirationPolicyOlderThanEnum, null: true, description: 'Tags older that this will expire.' field :cadence, Types::ContainerExpirationPolicyCadenceEnum, null: false, description: 'This container expiration policy schedule.' field :keep_n, Types::ContainerExpirationPolicyKeepEnum, null: true, description: 'Number of tags to retain.' diff --git a/app/graphql/types/container_repository_tag_type.rb b/app/graphql/types/container_repository_tag_type.rb index 6de16416395..b6b65bce421 100644 --- a/app/graphql/types/container_repository_tag_type.rb +++ b/app/graphql/types/container_repository_tag_type.rb @@ -8,15 +8,15 @@ module Types authorize :read_container_image - field :name, GraphQL::STRING_TYPE, null: false, description: 'Name of the tag.' - field :path, GraphQL::STRING_TYPE, null: false, description: 'Path of the tag.' - field :location, GraphQL::STRING_TYPE, null: false, description: 'URL of the tag.' - field :digest, GraphQL::STRING_TYPE, null: true, description: 'Digest of the tag.' - field :revision, GraphQL::STRING_TYPE, null: true, description: 'Revision of the tag.' - field :short_revision, GraphQL::STRING_TYPE, null: true, description: 'Short revision of the tag.' + field :name, GraphQL::Types::String, null: false, description: 'Name of the tag.' + field :path, GraphQL::Types::String, null: false, description: 'Path of the tag.' + field :location, GraphQL::Types::String, null: false, description: 'URL of the tag.' + field :digest, GraphQL::Types::String, null: true, description: 'Digest of the tag.' + field :revision, GraphQL::Types::String, null: true, description: 'Revision of the tag.' + field :short_revision, GraphQL::Types::String, null: true, description: 'Short revision of the tag.' field :total_size, GraphQL::Types::BigInt, null: true, description: 'The size of the tag.' field :created_at, Types::TimeType, null: true, description: 'Timestamp when the tag was created.' - field :can_delete, GraphQL::BOOLEAN_TYPE, null: false, description: 'Can the current user delete this tag.' + field :can_delete, GraphQL::Types::Boolean, null: false, description: 'Can the current user delete this tag.' def can_delete Ability.allowed?(current_user, :destroy_container_image, object) diff --git a/app/graphql/types/container_repository_type.rb b/app/graphql/types/container_repository_type.rb index 48c2b9f460f..91a65053131 100644 --- a/app/graphql/types/container_repository_type.rb +++ b/app/graphql/types/container_repository_type.rb @@ -8,17 +8,17 @@ module Types authorize :read_container_image - field :id, GraphQL::ID_TYPE, null: false, description: 'ID of the container repository.' - field :name, GraphQL::STRING_TYPE, null: false, description: 'Name of the container repository.' - field :path, GraphQL::STRING_TYPE, null: false, description: 'Path of the container repository.' - field :location, GraphQL::STRING_TYPE, null: false, description: 'URL of the container repository.' + field :id, GraphQL::Types::ID, null: false, description: 'ID of the container repository.' + field :name, GraphQL::Types::String, null: false, description: 'Name of the container repository.' + field :path, GraphQL::Types::String, null: false, description: 'Path of the container repository.' + field :location, GraphQL::Types::String, null: false, description: 'URL of the container repository.' field :created_at, Types::TimeType, null: false, description: 'Timestamp when the container repository was created.' field :updated_at, Types::TimeType, null: false, description: 'Timestamp when the container repository was updated.' field :expiration_policy_started_at, Types::TimeType, null: true, description: 'Timestamp when the cleanup done by the expiration policy was started on the container repository.' field :expiration_policy_cleanup_status, Types::ContainerRepositoryCleanupStatusEnum, null: true, description: 'The tags cleanup status for the container repository.' field :status, Types::ContainerRepositoryStatusEnum, null: true, description: 'Status of the container repository.' - field :tags_count, GraphQL::INT_TYPE, null: false, description: 'Number of tags associated with this image.' - field :can_delete, GraphQL::BOOLEAN_TYPE, null: false, description: 'Can the current user delete the container repository.' + field :tags_count, GraphQL::Types::Int, null: false, description: 'Number of tags associated with this image.' + field :can_delete, GraphQL::Types::Boolean, null: false, description: 'Can the current user delete the container repository.' field :project, Types::ProjectType, null: false, description: 'Project of the container registry.' def can_delete diff --git a/app/graphql/types/countable_connection_type.rb b/app/graphql/types/countable_connection_type.rb index 0a9699a4570..0f24964daa6 100644 --- a/app/graphql/types/countable_connection_type.rb +++ b/app/graphql/types/countable_connection_type.rb @@ -3,7 +3,7 @@ module Types # rubocop: disable Graphql/AuthorizeTypes class CountableConnectionType < GraphQL::Types::Relay::BaseConnection - field :count, GraphQL::INT_TYPE, null: false, + field :count, GraphQL::Types::Int, null: false, description: 'Total count of collection.' def count diff --git a/app/graphql/types/custom_emoji_type.rb b/app/graphql/types/custom_emoji_type.rb index 246b60ce184..64381b3ee1e 100644 --- a/app/graphql/types/custom_emoji_type.rb +++ b/app/graphql/types/custom_emoji_type.rb @@ -11,16 +11,16 @@ module Types null: false, description: 'The ID of the emoji.' - field :name, GraphQL::STRING_TYPE, + field :name, GraphQL::Types::String, null: false, description: 'The name of the emoji.' - field :url, GraphQL::STRING_TYPE, + field :url, GraphQL::Types::String, null: false, method: :file, description: 'The link to file of the emoji.' - field :external, GraphQL::BOOLEAN_TYPE, + field :external, GraphQL::Types::Boolean, null: false, description: 'Whether the emoji is an external link.' end diff --git a/app/graphql/types/design_management/design_fields.rb b/app/graphql/types/design_management/design_fields.rb index b770e30f5be..7779c3f1bcb 100644 --- a/app/graphql/types/design_management/design_fields.rb +++ b/app/graphql/types/design_management/design_fields.rb @@ -7,13 +7,13 @@ module Types field_class Types::BaseField - field :id, GraphQL::ID_TYPE, description: 'The ID of this design.', null: false + field :id, GraphQL::Types::ID, description: 'The ID of this design.', null: false field :project, Types::ProjectType, null: false, description: 'The project the design belongs to.' field :issue, Types::IssueType, null: false, description: 'The issue the design belongs to.' - field :filename, GraphQL::STRING_TYPE, null: false, description: 'The filename of the design.' - field :full_path, GraphQL::STRING_TYPE, null: false, description: 'The full path to the design file.' - field :image, GraphQL::STRING_TYPE, null: false, extras: [:parent], description: 'The URL of the full-sized image.' - field :image_v432x230, GraphQL::STRING_TYPE, null: true, extras: [:parent], + field :filename, GraphQL::Types::String, null: false, description: 'The filename of the design.' + field :full_path, GraphQL::Types::String, null: false, description: 'The full path to the design file.' + field :image, GraphQL::Types::String, null: false, extras: [:parent], description: 'The URL of the full-sized image.' + field :image_v432x230, GraphQL::Types::String, null: true, extras: [:parent], description: 'The URL of the design resized to fit within the bounds of 432x230. ' \ 'This will be `null` if the image has not been generated' field :diff_refs, Types::DiffRefsType, @@ -26,7 +26,7 @@ module Types extras: [:parent], description: 'How this design was changed in the current version.' field :notes_count, - GraphQL::INT_TYPE, + GraphQL::Types::Int, null: false, method: :user_notes_count, description: 'The total count of user-created notes for this design.' diff --git a/app/graphql/types/design_management/version_type.rb b/app/graphql/types/design_management/version_type.rb index 265d6185110..cfd2b887dc3 100644 --- a/app/graphql/types/design_management/version_type.rb +++ b/app/graphql/types/design_management/version_type.rb @@ -11,9 +11,9 @@ module Types authorize :read_design - field :id, GraphQL::ID_TYPE, null: false, + field :id, GraphQL::Types::ID, null: false, description: 'ID of the design version.' - field :sha, GraphQL::ID_TYPE, null: false, + field :sha, GraphQL::Types::ID, null: false, description: 'SHA of the design version.' field :designs, diff --git a/app/graphql/types/diff_paths_input_type.rb b/app/graphql/types/diff_paths_input_type.rb index d148b7656eb..e1d3d58411c 100644 --- a/app/graphql/types/diff_paths_input_type.rb +++ b/app/graphql/types/diff_paths_input_type.rb @@ -2,9 +2,9 @@ module Types class DiffPathsInputType < BaseInputObject - argument :old_path, GraphQL::STRING_TYPE, required: false, + argument :old_path, GraphQL::Types::String, required: false, description: 'The path of the file on the start sha.' - argument :new_path, GraphQL::STRING_TYPE, required: false, + argument :new_path, GraphQL::Types::String, required: false, description: 'The path of the file on the head sha.' end end diff --git a/app/graphql/types/diff_refs_type.rb b/app/graphql/types/diff_refs_type.rb index 3c8f934f1eb..b19d09c789c 100644 --- a/app/graphql/types/diff_refs_type.rb +++ b/app/graphql/types/diff_refs_type.rb @@ -6,11 +6,11 @@ module Types class DiffRefsType < BaseObject graphql_name 'DiffRefs' - field :head_sha, GraphQL::STRING_TYPE, null: false, + field :head_sha, GraphQL::Types::String, null: false, description: 'SHA of the HEAD at the time the comment was made.' - field :base_sha, GraphQL::STRING_TYPE, null: true, + field :base_sha, GraphQL::Types::String, null: true, description: 'Merge base of the branch the comment was made on.' - field :start_sha, GraphQL::STRING_TYPE, null: false, + field :start_sha, GraphQL::Types::String, null: false, description: 'SHA of the branch being compared against.' end # rubocop: enable Graphql/AuthorizeTypes diff --git a/app/graphql/types/diff_stats_summary_type.rb b/app/graphql/types/diff_stats_summary_type.rb index 78c0e2f2b4c..079c73d0759 100644 --- a/app/graphql/types/diff_stats_summary_type.rb +++ b/app/graphql/types/diff_stats_summary_type.rb @@ -8,13 +8,13 @@ module Types description 'Aggregated summary of changes' - field :additions, GraphQL::INT_TYPE, null: false, + field :additions, GraphQL::Types::Int, null: false, description: 'Number of lines added.' - field :deletions, GraphQL::INT_TYPE, null: false, + field :deletions, GraphQL::Types::Int, null: false, description: 'Number of lines deleted.' - field :changes, GraphQL::INT_TYPE, null: false, + field :changes, GraphQL::Types::Int, null: false, description: 'Number of lines changed.' - field :file_count, GraphQL::INT_TYPE, null: false, + field :file_count, GraphQL::Types::Int, null: false, description: 'Number of files changed.' def changes diff --git a/app/graphql/types/diff_stats_type.rb b/app/graphql/types/diff_stats_type.rb index 8a6840e5a94..60aacca8ce5 100644 --- a/app/graphql/types/diff_stats_type.rb +++ b/app/graphql/types/diff_stats_type.rb @@ -8,11 +8,11 @@ module Types description 'Changes to a single file' - field :path, GraphQL::STRING_TYPE, null: false, + field :path, GraphQL::Types::String, null: false, description: 'File path, relative to repository root.' - field :additions, GraphQL::INT_TYPE, null: false, + field :additions, GraphQL::Types::Int, null: false, description: 'Number of lines added to this file.' - field :deletions, GraphQL::INT_TYPE, null: false, + field :deletions, GraphQL::Types::Int, null: false, description: 'Number of lines deleted from this file.' end # rubocop: enable Graphql/AuthorizeTypes diff --git a/app/graphql/types/environment_type.rb b/app/graphql/types/environment_type.rb index 2e6417f08ea..267ca944198 100644 --- a/app/graphql/types/environment_type.rb +++ b/app/graphql/types/environment_type.rb @@ -9,16 +9,16 @@ module Types authorize :read_environment - field :name, GraphQL::STRING_TYPE, null: false, + field :name, GraphQL::Types::String, null: false, description: 'Human-readable name of the environment.' - field :id, GraphQL::ID_TYPE, null: false, + field :id, GraphQL::Types::ID, null: false, description: 'ID of the environment.' - field :state, GraphQL::STRING_TYPE, null: false, + field :state, GraphQL::Types::String, null: false, description: 'State of the environment, for example: available/stopped.' - field :path, GraphQL::STRING_TYPE, null: false, + field :path, GraphQL::Types::String, null: false, description: 'The path to the environment.' field :metrics_dashboard, Types::Metrics::DashboardType, null: true, diff --git a/app/graphql/types/error_tracking/sentry_detailed_error_type.rb b/app/graphql/types/error_tracking/sentry_detailed_error_type.rb index 59bd97e3448..79e789d3f8b 100644 --- a/app/graphql/types/error_tracking/sentry_detailed_error_type.rb +++ b/app/graphql/types/error_tracking/sentry_detailed_error_type.rb @@ -10,23 +10,23 @@ module Types authorize :read_sentry_issue - field :id, GraphQL::ID_TYPE, + field :id, GraphQL::Types::ID, null: false, description: 'ID (global ID) of the error.' - field :sentry_id, GraphQL::STRING_TYPE, + field :sentry_id, GraphQL::Types::String, method: :id, null: false, description: 'ID (Sentry ID) of the error.' - field :title, GraphQL::STRING_TYPE, + field :title, GraphQL::Types::String, null: false, description: 'Title of the error.' - field :type, GraphQL::STRING_TYPE, + field :type, GraphQL::Types::String, null: false, description: 'Type of the error.' - field :user_count, GraphQL::INT_TYPE, + field :user_count, GraphQL::Types::Int, null: false, description: 'Count of users affected by the error.' - field :count, GraphQL::INT_TYPE, + field :count, GraphQL::Types::Int, null: false, description: 'Count of occurrences.' field :first_seen, Types::TimeType, @@ -35,31 +35,31 @@ module Types field :last_seen, Types::TimeType, null: false, description: 'Timestamp when the error was last seen.' - field :message, GraphQL::STRING_TYPE, + field :message, GraphQL::Types::String, null: true, description: 'Sentry metadata message of the error.' - field :culprit, GraphQL::STRING_TYPE, + field :culprit, GraphQL::Types::String, null: false, description: 'Culprit of the error.' - field :external_base_url, GraphQL::STRING_TYPE, + field :external_base_url, GraphQL::Types::String, null: false, description: 'External Base URL of the Sentry Instance.' - field :external_url, GraphQL::STRING_TYPE, + field :external_url, GraphQL::Types::String, null: false, description: 'External URL of the error.' - field :sentry_project_id, GraphQL::ID_TYPE, + field :sentry_project_id, GraphQL::Types::ID, method: :project_id, null: false, description: 'ID of the project (Sentry project).' - field :sentry_project_name, GraphQL::STRING_TYPE, + field :sentry_project_name, GraphQL::Types::String, method: :project_name, null: false, description: 'Name of the project affected by the error.' - field :sentry_project_slug, GraphQL::STRING_TYPE, + field :sentry_project_slug, GraphQL::Types::String, method: :project_slug, null: false, description: 'Slug of the project affected by the error.' - field :short_id, GraphQL::STRING_TYPE, + field :short_id, GraphQL::Types::String, null: false, description: 'Short ID (Sentry ID) of the error.' field :status, Types::ErrorTracking::SentryErrorStatusEnum, @@ -68,31 +68,31 @@ module Types field :frequency, [Types::ErrorTracking::SentryErrorFrequencyType], null: false, description: 'Last 24hr stats of the error.' - field :first_release_last_commit, GraphQL::STRING_TYPE, + field :first_release_last_commit, GraphQL::Types::String, null: true, description: 'Commit the error was first seen.' - field :last_release_last_commit, GraphQL::STRING_TYPE, + field :last_release_last_commit, GraphQL::Types::String, null: true, description: 'Commit the error was last seen.' - field :first_release_short_version, GraphQL::STRING_TYPE, + field :first_release_short_version, GraphQL::Types::String, null: true, description: 'Release short version the error was first seen.' - field :last_release_short_version, GraphQL::STRING_TYPE, + field :last_release_short_version, GraphQL::Types::String, null: true, description: 'Release short version the error was last seen.' - field :first_release_version, GraphQL::STRING_TYPE, + field :first_release_version, GraphQL::Types::String, null: true, description: 'Release version the error was first seen.' - field :last_release_version, GraphQL::STRING_TYPE, + field :last_release_version, GraphQL::Types::String, null: true, description: 'Release version the error was last seen.' - field :gitlab_commit, GraphQL::STRING_TYPE, + field :gitlab_commit, GraphQL::Types::String, null: true, description: 'GitLab commit SHA attributed to the Error based on the release version.' - field :gitlab_commit_path, GraphQL::STRING_TYPE, + field :gitlab_commit_path, GraphQL::Types::String, null: true, description: 'Path to the GitLab page for the GitLab commit attributed to the error.' - field :gitlab_issue_path, GraphQL::STRING_TYPE, + field :gitlab_issue_path, GraphQL::Types::String, method: :gitlab_issue, null: true, description: 'URL of GitLab Issue.' diff --git a/app/graphql/types/error_tracking/sentry_error_collection_type.rb b/app/graphql/types/error_tracking/sentry_error_collection_type.rb index d3941b7c410..2d8c3d3d326 100644 --- a/app/graphql/types/error_tracking/sentry_error_collection_type.rb +++ b/app/graphql/types/error_tracking/sentry_error_collection_type.rb @@ -18,7 +18,7 @@ module Types description: 'Stack Trace of Sentry Error.', resolver: Resolvers::ErrorTracking::SentryErrorStackTraceResolver field :external_url, - GraphQL::STRING_TYPE, + GraphQL::Types::String, null: true, description: "External URL for Sentry." end diff --git a/app/graphql/types/error_tracking/sentry_error_frequency_type.rb b/app/graphql/types/error_tracking/sentry_error_frequency_type.rb index 05af1391af3..49a1b1e0476 100644 --- a/app/graphql/types/error_tracking/sentry_error_frequency_type.rb +++ b/app/graphql/types/error_tracking/sentry_error_frequency_type.rb @@ -9,7 +9,7 @@ module Types field :time, Types::TimeType, null: false, description: "Time the error frequency stats were recorded." - field :count, GraphQL::INT_TYPE, + field :count, GraphQL::Types::Int, null: false, description: "Count of errors received since the previously recorded time." end diff --git a/app/graphql/types/error_tracking/sentry_error_stack_trace_context_type.rb b/app/graphql/types/error_tracking/sentry_error_stack_trace_context_type.rb index 0b3c4cf55b9..ad31854b30c 100644 --- a/app/graphql/types/error_tracking/sentry_error_stack_trace_context_type.rb +++ b/app/graphql/types/error_tracking/sentry_error_stack_trace_context_type.rb @@ -8,11 +8,11 @@ module Types description 'An object context for a Sentry error stack trace' field :line, - GraphQL::INT_TYPE, + GraphQL::Types::Int, null: false, description: 'Line number of the context.' field :code, - GraphQL::STRING_TYPE, + GraphQL::Types::String, null: false, description: 'Code number of the context.' diff --git a/app/graphql/types/error_tracking/sentry_error_stack_trace_entry_type.rb b/app/graphql/types/error_tracking/sentry_error_stack_trace_entry_type.rb index c9915d052f9..e8f78004569 100644 --- a/app/graphql/types/error_tracking/sentry_error_stack_trace_entry_type.rb +++ b/app/graphql/types/error_tracking/sentry_error_stack_trace_entry_type.rb @@ -7,16 +7,16 @@ module Types graphql_name 'SentryErrorStackTraceEntry' description 'An object containing a stack trace entry for a Sentry error' - field :function, GraphQL::STRING_TYPE, + field :function, GraphQL::Types::String, null: true, description: 'Function in which the Sentry error occurred.' - field :col, GraphQL::STRING_TYPE, + field :col, GraphQL::Types::String, null: true, description: 'Function in which the Sentry error occurred.' - field :line, GraphQL::STRING_TYPE, + field :line, GraphQL::Types::String, null: true, description: 'Function in which the Sentry error occurred.' - field :file_name, GraphQL::STRING_TYPE, + field :file_name, GraphQL::Types::String, null: true, description: 'File in which the Sentry error occurred.' field :trace_context, [Types::ErrorTracking::SentryErrorStackTraceContextType], diff --git a/app/graphql/types/error_tracking/sentry_error_stack_trace_type.rb b/app/graphql/types/error_tracking/sentry_error_stack_trace_type.rb index 52959a9329b..dff52d77109 100644 --- a/app/graphql/types/error_tracking/sentry_error_stack_trace_type.rb +++ b/app/graphql/types/error_tracking/sentry_error_stack_trace_type.rb @@ -8,10 +8,10 @@ module Types authorize :read_sentry_issue - field :issue_id, GraphQL::STRING_TYPE, + field :issue_id, GraphQL::Types::String, null: false, description: 'ID of the Sentry error.' - field :date_received, GraphQL::STRING_TYPE, + field :date_received, GraphQL::Types::String, null: false, description: 'Time the stack trace was received by Sentry.' field :stack_trace_entries, [Types::ErrorTracking::SentryErrorStackTraceEntryType], diff --git a/app/graphql/types/error_tracking/sentry_error_tags_type.rb b/app/graphql/types/error_tracking/sentry_error_tags_type.rb index e2b051998c5..4d069615e3a 100644 --- a/app/graphql/types/error_tracking/sentry_error_tags_type.rb +++ b/app/graphql/types/error_tracking/sentry_error_tags_type.rb @@ -7,10 +7,10 @@ module Types graphql_name 'SentryErrorTags' description 'State of a Sentry error' - field :level, GraphQL::STRING_TYPE, + field :level, GraphQL::Types::String, null: true, description: "Severity level of the Sentry Error." - field :logger, GraphQL::STRING_TYPE, + field :logger, GraphQL::Types::String, null: true, description: "Logger of the Sentry Error." end diff --git a/app/graphql/types/error_tracking/sentry_error_type.rb b/app/graphql/types/error_tracking/sentry_error_type.rb index c0e09fb8c65..aaa6cbfb28f 100644 --- a/app/graphql/types/error_tracking/sentry_error_type.rb +++ b/app/graphql/types/error_tracking/sentry_error_type.rb @@ -9,10 +9,10 @@ module Types present_using SentryErrorPresenter - field :id, GraphQL::ID_TYPE, + field :id, GraphQL::Types::ID, null: false, description: 'ID (global ID) of the error.' - field :sentry_id, GraphQL::STRING_TYPE, + field :sentry_id, GraphQL::Types::String, method: :id, null: false, description: 'ID (Sentry ID) of the error.' @@ -22,28 +22,28 @@ module Types field :last_seen, Types::TimeType, null: false, description: 'Timestamp when the error was last seen.' - field :title, GraphQL::STRING_TYPE, + field :title, GraphQL::Types::String, null: false, description: 'Title of the error.' - field :type, GraphQL::STRING_TYPE, + field :type, GraphQL::Types::String, null: false, description: 'Type of the error.' - field :user_count, GraphQL::INT_TYPE, + field :user_count, GraphQL::Types::Int, null: false, description: 'Count of users affected by the error.' - field :count, GraphQL::INT_TYPE, + field :count, GraphQL::Types::Int, null: false, description: 'Count of occurrences.' - field :message, GraphQL::STRING_TYPE, + field :message, GraphQL::Types::String, null: true, description: 'Sentry metadata message of the error.' - field :culprit, GraphQL::STRING_TYPE, + field :culprit, GraphQL::Types::String, null: false, description: 'Culprit of the error.' - field :external_url, GraphQL::STRING_TYPE, + field :external_url, GraphQL::Types::String, null: false, description: 'External URL of the error.' - field :short_id, GraphQL::STRING_TYPE, + field :short_id, GraphQL::Types::String, null: false, description: 'Short ID (Sentry ID) of the error.' field :status, Types::ErrorTracking::SentryErrorStatusEnum, @@ -52,15 +52,15 @@ module Types field :frequency, [Types::ErrorTracking::SentryErrorFrequencyType], null: false, description: 'Last 24hr stats of the error.' - field :sentry_project_id, GraphQL::ID_TYPE, + field :sentry_project_id, GraphQL::Types::ID, method: :project_id, null: false, description: 'ID of the project (Sentry project).' - field :sentry_project_name, GraphQL::STRING_TYPE, + field :sentry_project_name, GraphQL::Types::String, method: :project_name, null: false, description: 'Name of the project affected by the error.' - field :sentry_project_slug, GraphQL::STRING_TYPE, + field :sentry_project_slug, GraphQL::Types::String, method: :project_slug, null: false, description: 'Slug of the project affected by the error.' diff --git a/app/graphql/types/event_type.rb b/app/graphql/types/event_type.rb index 2a4c2e7c60a..f4e680e93ef 100644 --- a/app/graphql/types/event_type.rb +++ b/app/graphql/types/event_type.rb @@ -9,7 +9,7 @@ module Types authorize :read_event - field :id, GraphQL::ID_TYPE, + field :id, GraphQL::Types::ID, description: 'ID of the event.', null: false diff --git a/app/graphql/types/evidence_type.rb b/app/graphql/types/evidence_type.rb index 6e56ad7d407..26fb64d25d8 100644 --- a/app/graphql/types/evidence_type.rb +++ b/app/graphql/types/evidence_type.rb @@ -9,11 +9,11 @@ module Types present_using Releases::EvidencePresenter - field :id, GraphQL::ID_TYPE, null: false, + field :id, GraphQL::Types::ID, null: false, description: 'ID of the evidence.' - field :sha, GraphQL::STRING_TYPE, null: true, + field :sha, GraphQL::Types::String, null: true, description: 'SHA1 ID of the evidence hash.' - field :filepath, GraphQL::STRING_TYPE, null: true, + field :filepath, GraphQL::Types::String, null: true, description: 'URL from where the evidence can be downloaded.' field :collected_at, Types::TimeType, null: true, description: 'Timestamp when the evidence was collected.' diff --git a/app/graphql/types/grafana_integration_type.rb b/app/graphql/types/grafana_integration_type.rb index 630d3a10e36..26fefd51e08 100644 --- a/app/graphql/types/grafana_integration_type.rb +++ b/app/graphql/types/grafana_integration_type.rb @@ -6,11 +6,11 @@ module Types authorize :admin_operations - field :id, GraphQL::ID_TYPE, null: false, + field :id, GraphQL::Types::ID, null: false, description: 'Internal ID of the Grafana integration.' - field :grafana_url, GraphQL::STRING_TYPE, null: false, + field :grafana_url, GraphQL::Types::String, null: false, description: 'URL for the Grafana host for the Grafana integration.' - field :enabled, GraphQL::BOOLEAN_TYPE, null: false, + field :enabled, GraphQL::Types::Boolean, null: false, description: 'Indicates whether Grafana integration is enabled.' field :created_at, Types::TimeType, null: false, description: 'Timestamp of the issue\'s creation.' diff --git a/app/graphql/types/group_type.rb b/app/graphql/types/group_type.rb index 27f4ae47c41..fbf0084cd0e 100644 --- a/app/graphql/types/group_type.rb +++ b/app/graphql/types/group_type.rb @@ -9,12 +9,12 @@ module Types expose_permissions Types::PermissionTypes::Group field :web_url, - type: GraphQL::STRING_TYPE, + type: GraphQL::Types::String, null: false, description: 'Web URL of the group.' field :avatar_url, - type: GraphQL::STRING_TYPE, + type: GraphQL::Types::String, null: true, description: 'Avatar URL of the group.' @@ -25,42 +25,42 @@ module Types feature_flag: :custom_emoji field :share_with_group_lock, - type: GraphQL::BOOLEAN_TYPE, + type: GraphQL::Types::Boolean, null: true, description: 'Indicates if sharing a project with another group within this group is prevented.' field :project_creation_level, - type: GraphQL::STRING_TYPE, + type: GraphQL::Types::String, null: true, method: :project_creation_level_str, description: 'The permission level required to create projects in the group.' field :subgroup_creation_level, - type: GraphQL::STRING_TYPE, + type: GraphQL::Types::String, null: true, method: :subgroup_creation_level_str, description: 'The permission level required to create subgroups within the group.' field :require_two_factor_authentication, - type: GraphQL::BOOLEAN_TYPE, + type: GraphQL::Types::Boolean, null: true, description: 'Indicates if all users in this group are required to set up two-factor authentication.' field :two_factor_grace_period, - type: GraphQL::INT_TYPE, + type: GraphQL::Types::Int, null: true, description: 'Time before two-factor authentication is enforced.' field :auto_devops_enabled, - type: GraphQL::BOOLEAN_TYPE, + type: GraphQL::Types::Boolean, null: true, description: 'Indicates whether Auto DevOps is enabled for all projects within this group.' field :emails_disabled, - type: GraphQL::BOOLEAN_TYPE, + type: GraphQL::Types::Boolean, null: true, description: 'Indicates if a group has email notifications disabled.' field :mentions_disabled, - type: GraphQL::BOOLEAN_TYPE, + type: GraphQL::Types::Boolean, null: true, description: 'Indicates if a group is disabled from getting mentioned.' @@ -103,7 +103,7 @@ module Types null: true, description: 'A label available on this group.' do argument :title, - type: GraphQL::STRING_TYPE, + type: GraphQL::Types::String, required: true, description: 'Title of the label.' end @@ -120,7 +120,7 @@ module Types authorize: :read_container_image field :container_repositories_count, - type: GraphQL::INT_TYPE, + type: GraphQL::Types::Int, null: false, description: 'Number of container repositories in the group.' @@ -149,6 +149,12 @@ module Types complexity: 5, resolver: ::Resolvers::TimelogResolver + field :descendant_groups, Types::GroupType.connection_type, + null: true, + description: 'List of descendant groups of this group.', + complexity: 5, + resolver: Resolvers::GroupsResolver + def avatar_url object.avatar_url(only_path: false) end diff --git a/app/graphql/types/invitation_interface.rb b/app/graphql/types/invitation_interface.rb index b1f69f043f2..1f0746d7726 100644 --- a/app/graphql/types/invitation_interface.rb +++ b/app/graphql/types/invitation_interface.rb @@ -4,7 +4,7 @@ module Types module InvitationInterface include BaseInterface - field :email, GraphQL::STRING_TYPE, null: false, + field :email, GraphQL::Types::String, null: false, description: 'Email of the member to invite.' field :access_level, Types::AccessLevelType, null: true, diff --git a/app/graphql/types/issue_status_counts_type.rb b/app/graphql/types/issue_status_counts_type.rb index 77429f9ea12..e4a0782e3cf 100644 --- a/app/graphql/types/issue_status_counts_type.rb +++ b/app/graphql/types/issue_status_counts_type.rb @@ -15,7 +15,7 @@ module Types next unless available_issue_states.include?(state.downcase) field state, - GraphQL::INT_TYPE, + GraphQL::Types::Int, null: true, description: "Number of issues with status #{state.upcase} for the project" end diff --git a/app/graphql/types/issue_type.rb b/app/graphql/types/issue_type.rb index 6ff38273c03..42feb8a8076 100644 --- a/app/graphql/types/issue_type.rb +++ b/app/graphql/types/issue_type.rb @@ -15,23 +15,23 @@ module Types present_using IssuePresenter - field :id, GraphQL::ID_TYPE, null: false, + field :id, GraphQL::Types::ID, null: false, description: "ID of the issue." - field :iid, GraphQL::ID_TYPE, null: false, + field :iid, GraphQL::Types::ID, null: false, description: "Internal ID of the issue." - field :title, GraphQL::STRING_TYPE, null: false, + field :title, GraphQL::Types::String, null: false, description: 'Title of the issue.' markdown_field :title_html, null: true - field :description, GraphQL::STRING_TYPE, null: true, + field :description, GraphQL::Types::String, null: true, description: 'Description of the issue.' markdown_field :description_html, null: true field :state, IssueStateEnum, null: false, description: 'State of the issue.' - field :reference, GraphQL::STRING_TYPE, null: false, + field :reference, GraphQL::Types::String, null: false, description: 'Internal reference of the issue. Returned in shortened format by default.', method: :to_reference do - argument :full, GraphQL::BOOLEAN_TYPE, required: false, default_value: false, + argument :full, GraphQL::Types::Boolean, required: false, default_value: false, description: 'Boolean option specifying whether the reference should be returned in full.' end @@ -51,42 +51,45 @@ module Types field :due_date, Types::TimeType, null: true, description: 'Due date of the issue.' - field :confidential, GraphQL::BOOLEAN_TYPE, null: false, + field :confidential, GraphQL::Types::Boolean, null: false, description: 'Indicates the issue is confidential.' - field :discussion_locked, GraphQL::BOOLEAN_TYPE, null: false, + field :discussion_locked, GraphQL::Types::Boolean, null: false, description: 'Indicates discussion is locked on the issue.' - field :upvotes, GraphQL::INT_TYPE, null: false, + field :upvotes, GraphQL::Types::Int, null: false, description: 'Number of upvotes the issue has received.' - field :downvotes, GraphQL::INT_TYPE, null: false, + field :downvotes, GraphQL::Types::Int, null: false, description: 'Number of downvotes the issue has received.' - field :user_notes_count, GraphQL::INT_TYPE, null: false, + field :merge_requests_count, GraphQL::Types::Int, null: false, + description: 'Number of merge requests that close the issue on merge.', + resolver: Resolvers::MergeRequestsCountResolver + field :user_notes_count, GraphQL::Types::Int, null: false, description: 'Number of user notes of the issue.', resolver: Resolvers::UserNotesCountResolver - field :user_discussions_count, GraphQL::INT_TYPE, null: false, + field :user_discussions_count, GraphQL::Types::Int, null: false, description: 'Number of user discussions in the issue.', resolver: Resolvers::UserDiscussionsCountResolver - field :web_path, GraphQL::STRING_TYPE, null: false, method: :issue_path, + field :web_path, GraphQL::Types::String, null: false, method: :issue_path, description: 'Web path of the issue.' - field :web_url, GraphQL::STRING_TYPE, null: false, + field :web_url, GraphQL::Types::String, null: false, description: 'Web URL of the issue.' - field :relative_position, GraphQL::INT_TYPE, null: true, + field :relative_position, GraphQL::Types::Int, null: true, description: 'Relative position of the issue (used for positioning in epic tree and issue boards).' field :participants, Types::UserType.connection_type, null: true, complexity: 5, description: 'List of participants in the issue.' - field :emails_disabled, GraphQL::BOOLEAN_TYPE, null: false, + field :emails_disabled, GraphQL::Types::Boolean, null: false, method: :project_emails_disabled?, description: 'Indicates if a project has email notifications disabled: `true` if email notifications are disabled.' - field :subscribed, GraphQL::BOOLEAN_TYPE, method: :subscribed?, null: false, complexity: 5, + field :subscribed, GraphQL::Types::Boolean, method: :subscribed?, null: false, complexity: 5, description: 'Indicates the currently logged in user is subscribed to the issue.' - field :time_estimate, GraphQL::INT_TYPE, null: false, + field :time_estimate, GraphQL::Types::Int, null: false, description: 'Time estimate of the issue.' - field :total_time_spent, GraphQL::INT_TYPE, null: false, + field :total_time_spent, GraphQL::Types::Int, null: false, description: 'Total time reported as spent on the issue.' - field :human_time_estimate, GraphQL::STRING_TYPE, null: true, + field :human_time_estimate, GraphQL::Types::String, null: true, description: 'Human-readable time estimate of the issue.' - field :human_total_time_spent, GraphQL::STRING_TYPE, null: true, + field :human_total_time_spent, GraphQL::Types::String, null: true, description: 'Human-readable total time reported as spent on the issue.' field :closed_at, Types::TimeType, null: true, @@ -115,19 +118,19 @@ module Types field :severity, Types::IssuableSeverityEnum, null: true, description: 'Severity level of the incident.' - field :moved, GraphQL::BOOLEAN_TYPE, method: :moved?, null: true, + field :moved, GraphQL::Types::Boolean, method: :moved?, null: true, description: 'Indicates if issue got moved from other project.' field :moved_to, Types::IssueType, null: true, description: 'Updated Issue after it got moved to another project.' - field :create_note_email, GraphQL::STRING_TYPE, null: true, + field :create_note_email, GraphQL::Types::String, null: true, description: 'User specific email address for the issue.' field :timelogs, Types::TimelogType.connection_type, null: false, description: 'Timelogs on the issue.' - field :project_id, GraphQL::INT_TYPE, null: false, method: :project_id, + field :project_id, GraphQL::Types::Int, null: false, method: :project_id, description: 'ID of the issue project.' def author diff --git a/app/graphql/types/issue_type_enum.rb b/app/graphql/types/issue_type_enum.rb index 7dc45f78c99..6999ea270a2 100644 --- a/app/graphql/types/issue_type_enum.rb +++ b/app/graphql/types/issue_type_enum.rb @@ -5,7 +5,7 @@ module Types graphql_name 'IssueType' description 'Issue type' - ::Issue.issue_types.keys.each do |issue_type| + ::WorkItem::Type.base_types.keys.each do |issue_type| value issue_type.upcase, value: issue_type, description: "#{issue_type.titleize} issue type" end end diff --git a/app/graphql/types/issues/negated_issue_filter_input_type.rb b/app/graphql/types/issues/negated_issue_filter_input_type.rb index 88faf7e7074..e5125c554a4 100644 --- a/app/graphql/types/issues/negated_issue_filter_input_type.rb +++ b/app/graphql/types/issues/negated_issue_filter_input_type.rb @@ -5,21 +5,24 @@ module Types class NegatedIssueFilterInputType < BaseInputObject graphql_name 'NegatedIssueFilterInput' - argument :iids, [GraphQL::STRING_TYPE], + argument :iids, [GraphQL::Types::String], required: false, description: 'List of IIDs of issues to exclude. For example, `[1, 2]`.' - argument :label_name, [GraphQL::STRING_TYPE], + argument :label_name, [GraphQL::Types::String], required: false, description: 'Labels not applied to this issue.' - argument :milestone_title, [GraphQL::STRING_TYPE], + argument :milestone_title, [GraphQL::Types::String], required: false, description: 'Milestone not applied to this issue.' - argument :assignee_usernames, [GraphQL::STRING_TYPE], + argument :assignee_usernames, [GraphQL::Types::String], required: false, description: 'Usernames of users not assigned to the issue.' - argument :assignee_id, GraphQL::STRING_TYPE, + argument :assignee_id, GraphQL::Types::String, required: false, description: 'ID of a user not assigned to the issues.' + argument :milestone_wildcard_id, ::Types::NegatedMilestoneWildcardIdEnum, + required: false, + description: 'Filter by negated milestone wildcard values.' end end end diff --git a/app/graphql/types/jira_import_type.rb b/app/graphql/types/jira_import_type.rb index 6fa115933ac..0cdfc178350 100644 --- a/app/graphql/types/jira_import_type.rb +++ b/app/graphql/types/jira_import_type.rb @@ -12,13 +12,13 @@ module Types description: 'Timestamp of when the Jira import was scheduled.' field :scheduled_by, Types::UserType, null: true, description: 'User that started the Jira import.' - field :jira_project_key, GraphQL::STRING_TYPE, null: false, + field :jira_project_key, GraphQL::Types::String, null: false, description: 'Project key for the imported Jira project.' - field :imported_issues_count, GraphQL::INT_TYPE, null: false, + field :imported_issues_count, GraphQL::Types::Int, null: false, description: 'Count of issues that were successfully imported.' - field :failed_to_import_count, GraphQL::INT_TYPE, null: false, + field :failed_to_import_count, GraphQL::Types::Int, null: false, description: 'Count of issues that failed to import.' - field :total_issue_count, GraphQL::INT_TYPE, null: false, + field :total_issue_count, GraphQL::Types::Int, null: false, description: 'Total count of issues that were attempted to import.' end # rubocop: enable Graphql/AuthorizeTypes diff --git a/app/graphql/types/jira_user_type.rb b/app/graphql/types/jira_user_type.rb index 7ccb7ad6791..6e1c349726c 100644 --- a/app/graphql/types/jira_user_type.rb +++ b/app/graphql/types/jira_user_type.rb @@ -6,17 +6,17 @@ module Types class JiraUserType < BaseObject graphql_name 'JiraUser' - field :jira_account_id, GraphQL::STRING_TYPE, null: false, + field :jira_account_id, GraphQL::Types::String, null: false, description: 'Account ID of the Jira user.' - field :jira_display_name, GraphQL::STRING_TYPE, null: false, + field :jira_display_name, GraphQL::Types::String, null: false, description: 'Display name of the Jira user.' - field :jira_email, GraphQL::STRING_TYPE, null: true, + field :jira_email, GraphQL::Types::String, null: true, description: 'Email of the Jira user, returned only for users with public emails.' - field :gitlab_id, GraphQL::INT_TYPE, null: true, + field :gitlab_id, GraphQL::Types::Int, null: true, description: 'ID of the matched GitLab user.' - field :gitlab_username, GraphQL::STRING_TYPE, null: true, + field :gitlab_username, GraphQL::Types::String, null: true, description: 'Username of the matched GitLab user.' - field :gitlab_name, GraphQL::STRING_TYPE, null: true, + field :gitlab_name, GraphQL::Types::String, null: true, description: 'Name of the matched GitLab user.' end # rubocop: enable Graphql/AuthorizeTypes diff --git a/app/graphql/types/jira_users_mapping_input_type.rb b/app/graphql/types/jira_users_mapping_input_type.rb index 32640b9cb17..37fd05370c0 100644 --- a/app/graphql/types/jira_users_mapping_input_type.rb +++ b/app/graphql/types/jira_users_mapping_input_type.rb @@ -5,11 +5,11 @@ module Types graphql_name 'JiraUsersMappingInputType' argument :jira_account_id, - GraphQL::STRING_TYPE, + GraphQL::Types::String, required: true, description: 'Jira account ID of the user.' argument :gitlab_id, - GraphQL::INT_TYPE, + GraphQL::Types::Int, required: false, description: 'ID of the GitLab user.' end diff --git a/app/graphql/types/label_type.rb b/app/graphql/types/label_type.rb index 4e8718a80da..bb2d561014e 100644 --- a/app/graphql/types/label_type.rb +++ b/app/graphql/types/label_type.rb @@ -8,16 +8,16 @@ module Types authorize :read_label - field :id, GraphQL::ID_TYPE, null: false, + field :id, GraphQL::Types::ID, null: false, description: 'Label ID.' - field :description, GraphQL::STRING_TYPE, null: true, + field :description, GraphQL::Types::String, null: true, description: 'Description of the label (Markdown rendered as HTML for caching).' markdown_field :description_html, null: true - field :title, GraphQL::STRING_TYPE, null: false, + field :title, GraphQL::Types::String, null: false, description: 'Content of the label.' - field :color, GraphQL::STRING_TYPE, null: false, + field :color, GraphQL::Types::String, null: false, description: 'Background color of the label.' - field :text_color, GraphQL::STRING_TYPE, null: false, + field :text_color, GraphQL::Types::String, null: false, description: 'Text color of the label.' field :created_at, Types::TimeType, null: false, description: 'When this label was created.' diff --git a/app/graphql/types/member_interface.rb b/app/graphql/types/member_interface.rb index 6a21e51fe28..c5623cd4710 100644 --- a/app/graphql/types/member_interface.rb +++ b/app/graphql/types/member_interface.rb @@ -4,7 +4,7 @@ module Types module MemberInterface include BaseInterface - field :id, GraphQL::ID_TYPE, null: false, + field :id, GraphQL::Types::ID, null: false, description: 'ID of the member.' field :access_level, Types::AccessLevelType, null: true, diff --git a/app/graphql/types/merge_request_sort_enum.rb b/app/graphql/types/merge_request_sort_enum.rb index 92a71998d91..d75eae6abc4 100644 --- a/app/graphql/types/merge_request_sort_enum.rb +++ b/app/graphql/types/merge_request_sort_enum.rb @@ -7,5 +7,7 @@ module Types value 'MERGED_AT_ASC', 'Merge time by ascending order.', value: :merged_at_asc value 'MERGED_AT_DESC', 'Merge time by descending order.', value: :merged_at_desc + value 'CLOSED_AT_ASC', 'Closed time by ascending order.', value: :closed_at_asc + value 'CLOSED_AT_DESC', 'Closed time by descending order.', value: :closed_at_desc end end diff --git a/app/graphql/types/merge_request_type.rb b/app/graphql/types/merge_request_type.rb index 0e9df926cdd..8e6b5421ede 100644 --- a/app/graphql/types/merge_request_type.rb +++ b/app/graphql/types/merge_request_type.rb @@ -15,14 +15,14 @@ module Types present_using MergeRequestPresenter - field :id, GraphQL::ID_TYPE, null: false, + field :id, GraphQL::Types::ID, null: false, description: 'ID of the merge request.' - field :iid, GraphQL::STRING_TYPE, null: false, + field :iid, GraphQL::Types::String, null: false, description: 'Internal ID of the merge request.' - field :title, GraphQL::STRING_TYPE, null: false, + field :title, GraphQL::Types::String, null: false, description: 'Title of the merge request.' markdown_field :title_html, null: true - field :description, GraphQL::STRING_TYPE, null: true, + field :description, GraphQL::Types::String, null: true, description: 'Description of the merge request (Markdown rendered as HTML for caching).' markdown_field :description_html, null: true field :state, MergeRequestStateEnum, null: false, @@ -41,91 +41,91 @@ module Types description: 'References of the base SHA, the head SHA, and the start SHA for this merge request.' field :project, Types::ProjectType, null: false, description: 'Alias for target_project.' - field :project_id, GraphQL::INT_TYPE, null: false, method: :target_project_id, + field :project_id, GraphQL::Types::Int, null: false, method: :target_project_id, description: 'ID of the merge request project.' - field :source_project_id, GraphQL::INT_TYPE, null: true, + field :source_project_id, GraphQL::Types::Int, null: true, description: 'ID of the merge request source project.' - field :target_project_id, GraphQL::INT_TYPE, null: false, + field :target_project_id, GraphQL::Types::Int, null: false, description: 'ID of the merge request target project.' - field :source_branch, GraphQL::STRING_TYPE, null: false, + field :source_branch, GraphQL::Types::String, null: false, description: 'Source branch of the merge request.' - field :source_branch_protected, GraphQL::BOOLEAN_TYPE, null: false, calls_gitaly: true, + field :source_branch_protected, GraphQL::Types::Boolean, null: false, calls_gitaly: true, description: 'Indicates if the source branch is protected.' - field :target_branch, GraphQL::STRING_TYPE, null: false, + field :target_branch, GraphQL::Types::String, null: false, description: 'Target branch of the merge request.' - field :work_in_progress, GraphQL::BOOLEAN_TYPE, method: :work_in_progress?, null: false, + field :work_in_progress, GraphQL::Types::Boolean, method: :work_in_progress?, null: false, deprecated: { reason: 'Use `draft`', milestone: '13.12' }, description: 'Indicates if the merge request is a draft.' - field :draft, GraphQL::BOOLEAN_TYPE, method: :draft?, null: false, + field :draft, GraphQL::Types::Boolean, method: :draft?, null: false, description: 'Indicates if the merge request is a draft.' - field :merge_when_pipeline_succeeds, GraphQL::BOOLEAN_TYPE, null: true, + field :merge_when_pipeline_succeeds, GraphQL::Types::Boolean, null: true, description: 'Indicates if the merge has been set to be merged when its pipeline succeeds (MWPS).' - field :diff_head_sha, GraphQL::STRING_TYPE, null: true, + field :diff_head_sha, GraphQL::Types::String, null: true, description: 'Diff head SHA of the merge request.' field :diff_stats, [Types::DiffStatsType], null: true, calls_gitaly: true, description: 'Details about which files were changed in this merge request.' do - argument :path, GraphQL::STRING_TYPE, required: false, description: 'A specific file-path.' + argument :path, GraphQL::Types::String, required: false, description: 'A specific file-path.' end field :diff_stats_summary, Types::DiffStatsSummaryType, null: true, calls_gitaly: true, description: 'Summary of which files were changed in this merge request.' - field :merge_commit_sha, GraphQL::STRING_TYPE, null: true, + field :merge_commit_sha, GraphQL::Types::String, null: true, description: 'SHA of the merge request commit (set once merged).' - field :user_notes_count, GraphQL::INT_TYPE, null: true, + field :user_notes_count, GraphQL::Types::Int, null: true, description: 'User notes count of the merge request.', resolver: Resolvers::UserNotesCountResolver - field :user_discussions_count, GraphQL::INT_TYPE, null: true, + field :user_discussions_count, GraphQL::Types::Int, null: true, description: 'Number of user discussions in the merge request.', resolver: Resolvers::UserDiscussionsCountResolver - field :should_remove_source_branch, GraphQL::BOOLEAN_TYPE, method: :should_remove_source_branch?, null: true, + field :should_remove_source_branch, GraphQL::Types::Boolean, method: :should_remove_source_branch?, null: true, description: 'Indicates if the source branch of the merge request will be deleted after merge.' - field :force_remove_source_branch, GraphQL::BOOLEAN_TYPE, method: :force_remove_source_branch?, null: true, + field :force_remove_source_branch, GraphQL::Types::Boolean, method: :force_remove_source_branch?, null: true, description: 'Indicates if the project settings will lead to source branch deletion after merge.' - field :merge_status, GraphQL::STRING_TYPE, method: :public_merge_status, null: true, + field :merge_status, GraphQL::Types::String, method: :public_merge_status, null: true, description: 'Status of the merge request.', deprecated: { reason: :renamed, replacement: 'MergeRequest.mergeStatusEnum', milestone: '14.0' } field :merge_status_enum, ::Types::MergeRequests::MergeStatusEnum, method: :public_merge_status, null: true, description: 'Merge status of the merge request.' - field :in_progress_merge_commit_sha, GraphQL::STRING_TYPE, null: true, + field :in_progress_merge_commit_sha, GraphQL::Types::String, null: true, description: 'Commit SHA of the merge request if merge is in progress.' - field :merge_error, GraphQL::STRING_TYPE, null: true, + field :merge_error, GraphQL::Types::String, null: true, description: 'Error message due to a merge error.' - field :allow_collaboration, GraphQL::BOOLEAN_TYPE, null: true, + field :allow_collaboration, GraphQL::Types::Boolean, null: true, description: 'Indicates if members of the target project can push to the fork.' - field :should_be_rebased, GraphQL::BOOLEAN_TYPE, method: :should_be_rebased?, null: false, calls_gitaly: true, + field :should_be_rebased, GraphQL::Types::Boolean, method: :should_be_rebased?, null: false, calls_gitaly: true, description: 'Indicates if the merge request will be rebased.' - field :rebase_commit_sha, GraphQL::STRING_TYPE, null: true, + field :rebase_commit_sha, GraphQL::Types::String, null: true, description: 'Rebase commit SHA of the merge request.' - field :rebase_in_progress, GraphQL::BOOLEAN_TYPE, method: :rebase_in_progress?, null: false, calls_gitaly: true, + field :rebase_in_progress, GraphQL::Types::Boolean, method: :rebase_in_progress?, null: false, calls_gitaly: true, description: 'Indicates if there is a rebase currently in progress for the merge request.' - field :default_merge_commit_message, GraphQL::STRING_TYPE, null: true, + field :default_merge_commit_message, GraphQL::Types::String, null: true, description: 'Default merge commit message of the merge request.' - field :default_merge_commit_message_with_description, GraphQL::STRING_TYPE, null: true, + field :default_merge_commit_message_with_description, GraphQL::Types::String, null: true, description: 'Default merge commit message of the merge request with description.' - field :default_squash_commit_message, GraphQL::STRING_TYPE, null: true, calls_gitaly: true, + field :default_squash_commit_message, GraphQL::Types::String, null: true, calls_gitaly: true, description: 'Default squash commit message of the merge request.' - field :merge_ongoing, GraphQL::BOOLEAN_TYPE, method: :merge_ongoing?, null: false, + field :merge_ongoing, GraphQL::Types::Boolean, method: :merge_ongoing?, null: false, description: 'Indicates if a merge is currently occurring.' - field :source_branch_exists, GraphQL::BOOLEAN_TYPE, + field :source_branch_exists, GraphQL::Types::Boolean, null: false, calls_gitaly: true, method: :source_branch_exists?, description: 'Indicates if the source branch of the merge request exists.' - field :target_branch_exists, GraphQL::BOOLEAN_TYPE, + field :target_branch_exists, GraphQL::Types::Boolean, null: false, calls_gitaly: true, method: :target_branch_exists?, description: 'Indicates if the target branch of the merge request exists.' - field :diverged_from_target_branch, GraphQL::BOOLEAN_TYPE, + field :diverged_from_target_branch, GraphQL::Types::Boolean, null: false, calls_gitaly: true, method: :diverged_from_target_branch?, description: 'Indicates if the source branch is behind the target branch.' - field :mergeable_discussions_state, GraphQL::BOOLEAN_TYPE, null: true, + field :mergeable_discussions_state, GraphQL::Types::Boolean, null: true, description: 'Indicates if all discussions in the merge request have been resolved, allowing the merge request to be merged.' - field :web_url, GraphQL::STRING_TYPE, null: true, + field :web_url, GraphQL::Types::String, null: true, description: 'Web URL of the merge request.' - field :upvotes, GraphQL::INT_TYPE, null: false, + field :upvotes, GraphQL::Types::Int, null: false, description: 'Number of upvotes for the merge request.' - field :downvotes, GraphQL::INT_TYPE, null: false, + field :downvotes, GraphQL::Types::Int, null: false, description: 'Number of downvotes for the merge request.' field :head_pipeline, Types::Ci::PipelineType, null: true, method: :actual_head_pipeline, @@ -151,52 +151,52 @@ module Types description: 'User who created this merge request.' field :participants, Types::UserType.connection_type, null: true, complexity: 15, description: 'Participants in the merge request. This includes the author, assignees, reviewers, and users mentioned in notes.' - field :subscribed, GraphQL::BOOLEAN_TYPE, method: :subscribed?, null: false, complexity: 5, + field :subscribed, GraphQL::Types::Boolean, method: :subscribed?, null: false, complexity: 5, description: 'Indicates if the currently logged in user is subscribed to this merge request.' field :labels, Types::LabelType.connection_type, null: true, complexity: 5, description: 'Labels of the merge request.' - field :discussion_locked, GraphQL::BOOLEAN_TYPE, + field :discussion_locked, GraphQL::Types::Boolean, description: 'Indicates if comments on the merge request are locked to members only.', null: false - field :time_estimate, GraphQL::INT_TYPE, null: false, + field :time_estimate, GraphQL::Types::Int, null: false, description: 'Time estimate of the merge request.' - field :total_time_spent, GraphQL::INT_TYPE, null: false, + field :total_time_spent, GraphQL::Types::Int, null: false, description: 'Total time reported as spent on the merge request.' - field :human_time_estimate, GraphQL::STRING_TYPE, null: true, + field :human_time_estimate, GraphQL::Types::String, null: true, description: 'Human-readable time estimate of the merge request.' - field :human_total_time_spent, GraphQL::STRING_TYPE, null: true, + field :human_total_time_spent, GraphQL::Types::String, null: true, description: 'Human-readable total time reported as spent on the merge request.' - field :reference, GraphQL::STRING_TYPE, null: false, method: :to_reference, + field :reference, GraphQL::Types::String, null: false, method: :to_reference, description: 'Internal reference of the merge request. Returned in shortened format by default.' do - argument :full, GraphQL::BOOLEAN_TYPE, required: false, default_value: false, + argument :full, GraphQL::Types::Boolean, required: false, default_value: false, description: 'Boolean option specifying whether the reference should be returned in full.' end field :task_completion_status, Types::TaskCompletionStatus, null: false, description: Types::TaskCompletionStatus.description - field :commit_count, GraphQL::INT_TYPE, null: true, method: :commits_count, + field :commit_count, GraphQL::Types::Int, null: true, method: :commits_count, description: 'Number of commits in the merge request.' - field :conflicts, GraphQL::BOOLEAN_TYPE, null: false, method: :cannot_be_merged?, + field :conflicts, GraphQL::Types::Boolean, null: false, method: :cannot_be_merged?, description: 'Indicates if the merge request has conflicts.' - field :auto_merge_enabled, GraphQL::BOOLEAN_TYPE, null: false, + field :auto_merge_enabled, GraphQL::Types::Boolean, null: false, description: 'Indicates if auto merge is enabled for the merge request.' field :approved_by, Types::UserType.connection_type, null: true, description: 'Users who approved the merge request.' - field :squash_on_merge, GraphQL::BOOLEAN_TYPE, null: false, method: :squash_on_merge?, + field :squash_on_merge, GraphQL::Types::Boolean, null: false, method: :squash_on_merge?, description: 'Indicates if squash on merge is enabled.' - field :squash, GraphQL::BOOLEAN_TYPE, null: false, + field :squash, GraphQL::Types::Boolean, null: false, description: 'Indicates if squash on merge is enabled.' - field :available_auto_merge_strategies, [GraphQL::STRING_TYPE], null: true, calls_gitaly: true, + field :available_auto_merge_strategies, [GraphQL::Types::String], null: true, calls_gitaly: true, description: 'Array of available auto merge strategies.' - field :has_ci, GraphQL::BOOLEAN_TYPE, null: false, method: :has_ci?, + field :has_ci, GraphQL::Types::Boolean, null: false, method: :has_ci?, description: 'Indicates if the merge request has CI.' - field :mergeable, GraphQL::BOOLEAN_TYPE, null: false, method: :mergeable?, calls_gitaly: true, + field :mergeable, GraphQL::Types::Boolean, null: false, method: :mergeable?, calls_gitaly: true, description: 'Indicates if the merge request is mergeable.' field :commits_without_merge_commits, Types::CommitType.connection_type, null: true, calls_gitaly: true, description: 'Merge request commits excluding merge commits.' - field :security_auto_fix, GraphQL::BOOLEAN_TYPE, null: true, + field :security_auto_fix, GraphQL::Types::Boolean, null: true, description: 'Indicates if the merge request is created by @GitLab-Security-Bot.' - field :auto_merge_strategy, GraphQL::STRING_TYPE, null: true, + field :auto_merge_strategy, GraphQL::Types::String, null: true, description: 'Selected auto merge strategy.' field :merge_user, Types::UserType, null: true, description: 'User who merged this merge request.' diff --git a/app/graphql/types/metadata/kas_type.rb b/app/graphql/types/metadata/kas_type.rb index 8af4c23270b..a947986fa60 100644 --- a/app/graphql/types/metadata/kas_type.rb +++ b/app/graphql/types/metadata/kas_type.rb @@ -7,11 +7,11 @@ module Types authorize :read_instance_metadata - field :enabled, GraphQL::BOOLEAN_TYPE, null: false, + field :enabled, GraphQL::Types::Boolean, null: false, description: 'Indicates whether the Kubernetes Agent Server is enabled.' - field :version, GraphQL::STRING_TYPE, null: true, + field :version, GraphQL::Types::String, null: true, description: 'KAS version.' - field :external_url, GraphQL::STRING_TYPE, null: true, + field :external_url, GraphQL::Types::String, null: true, description: 'The URL used by the Agents to communicate with KAS.' end end diff --git a/app/graphql/types/metadata_type.rb b/app/graphql/types/metadata_type.rb index 851c2a3f1e3..ed1e697711d 100644 --- a/app/graphql/types/metadata_type.rb +++ b/app/graphql/types/metadata_type.rb @@ -6,9 +6,9 @@ module Types authorize :read_instance_metadata - field :version, GraphQL::STRING_TYPE, null: false, + field :version, GraphQL::Types::String, null: false, description: 'Version.' - field :revision, GraphQL::STRING_TYPE, null: false, + field :revision, GraphQL::Types::String, null: false, description: 'Revision.' field :kas, ::Types::Metadata::KasType, null: false, description: 'Metadata about KAS.' diff --git a/app/graphql/types/metrics/dashboard_type.rb b/app/graphql/types/metrics/dashboard_type.rb index 40d2c2f195c..04cac55894e 100644 --- a/app/graphql/types/metrics/dashboard_type.rb +++ b/app/graphql/types/metrics/dashboard_type.rb @@ -7,10 +7,10 @@ module Types class DashboardType < ::Types::BaseObject graphql_name 'MetricsDashboard' - field :path, GraphQL::STRING_TYPE, null: true, + field :path, GraphQL::Types::String, null: true, description: 'Path to a file with the dashboard definition.' - field :schema_validation_warnings, [GraphQL::STRING_TYPE], null: true, + field :schema_validation_warnings, [GraphQL::Types::String], null: true, description: 'Dashboard schema validation warnings.' field :annotations, Types::Metrics::Dashboards::AnnotationType.connection_type, null: true, diff --git a/app/graphql/types/metrics/dashboards/annotation_type.rb b/app/graphql/types/metrics/dashboards/annotation_type.rb index b9e040dd063..fb35f2bd9a1 100644 --- a/app/graphql/types/metrics/dashboards/annotation_type.rb +++ b/app/graphql/types/metrics/dashboards/annotation_type.rb @@ -7,13 +7,13 @@ module Types authorize :read_metrics_dashboard_annotation graphql_name 'MetricsDashboardAnnotation' - field :description, GraphQL::STRING_TYPE, null: true, + field :description, GraphQL::Types::String, null: true, description: 'Description of the annotation.' - field :id, GraphQL::ID_TYPE, null: false, + field :id, GraphQL::Types::ID, null: false, description: 'ID of the annotation.' - field :panel_id, GraphQL::STRING_TYPE, null: true, + field :panel_id, GraphQL::Types::String, null: true, description: 'ID of a dashboard panel to which the annotation should be scoped.' field :starting_at, Types::TimeType, null: true, diff --git a/app/graphql/types/milestone_stats_type.rb b/app/graphql/types/milestone_stats_type.rb index e313b880e0d..6d8b7deb8e7 100644 --- a/app/graphql/types/milestone_stats_type.rb +++ b/app/graphql/types/milestone_stats_type.rb @@ -7,10 +7,10 @@ module Types authorize :read_milestone - field :total_issues_count, GraphQL::INT_TYPE, null: true, + field :total_issues_count, GraphQL::Types::Int, null: true, description: 'Total number of issues associated with the milestone.' - field :closed_issues_count, GraphQL::INT_TYPE, null: true, + field :closed_issues_count, GraphQL::Types::Int, null: true, description: 'Number of closed issues associated with the milestone.' end end diff --git a/app/graphql/types/milestone_type.rb b/app/graphql/types/milestone_type.rb index 27bc77b4da1..18e4a5d33e3 100644 --- a/app/graphql/types/milestone_type.rb +++ b/app/graphql/types/milestone_type.rb @@ -11,25 +11,25 @@ module Types alias_method :milestone, :object - field :id, GraphQL::ID_TYPE, null: false, + field :id, GraphQL::Types::ID, null: false, description: 'ID of the milestone.' - field :iid, GraphQL::ID_TYPE, null: false, + field :iid, GraphQL::Types::ID, null: false, description: "Internal ID of the milestone." - field :title, GraphQL::STRING_TYPE, null: false, + field :title, GraphQL::Types::String, null: false, description: 'Title of the milestone.' - field :description, GraphQL::STRING_TYPE, null: true, + field :description, GraphQL::Types::String, null: true, description: 'Description of the milestone.' field :state, Types::MilestoneStateEnum, null: false, description: 'State of the milestone.' - field :expired, GraphQL::BOOLEAN_TYPE, null: false, + field :expired, GraphQL::Types::Boolean, null: false, description: 'Expired state of the milestone (a milestone is expired when the due date is past the current date). Defaults to `false` when due date has not been set.' - field :web_path, GraphQL::STRING_TYPE, null: false, method: :milestone_path, + field :web_path, GraphQL::Types::String, null: false, method: :milestone_path, description: 'Web path of the milestone.' field :due_date, Types::TimeType, null: true, @@ -44,15 +44,15 @@ module Types field :updated_at, Types::TimeType, null: false, description: 'Timestamp of last milestone update.' - field :project_milestone, GraphQL::BOOLEAN_TYPE, null: false, + field :project_milestone, GraphQL::Types::Boolean, null: false, description: 'Indicates if milestone is at project level.', method: :project_milestone? - field :group_milestone, GraphQL::BOOLEAN_TYPE, null: false, + field :group_milestone, GraphQL::Types::Boolean, null: false, description: 'Indicates if milestone is at group level.', method: :group_milestone? - field :subgroup_milestone, GraphQL::BOOLEAN_TYPE, null: false, + field :subgroup_milestone, GraphQL::Types::Boolean, null: false, description: 'Indicates if milestone is at subgroup level.', method: :subgroup_milestone? diff --git a/app/graphql/types/milestone_wildcard_id_enum.rb b/app/graphql/types/milestone_wildcard_id_enum.rb new file mode 100644 index 00000000000..b5b339b1e5b --- /dev/null +++ b/app/graphql/types/milestone_wildcard_id_enum.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Types + class MilestoneWildcardIdEnum < BaseEnum + graphql_name 'MilestoneWildcardId' + description 'Milestone ID wildcard values' + + value 'NONE', 'No milestone is assigned.' + value 'ANY', 'A milestone is assigned.' + value 'STARTED', 'An open, started milestone (start date <= today).' + value 'UPCOMING', 'An open milestone due in the future (due date >= today).' + end +end diff --git a/app/graphql/types/mutation_type.rb b/app/graphql/types/mutation_type.rb index df693fafbb9..293d19d068a 100644 --- a/app/graphql/types/mutation_type.rb +++ b/app/graphql/types/mutation_type.rb @@ -99,14 +99,18 @@ module Types mount_mutation Mutations::Ci::CiCdSettingsUpdate mount_mutation Mutations::Ci::Job::Play mount_mutation Mutations::Ci::Job::Retry + mount_mutation Mutations::Ci::Job::Cancel + mount_mutation Mutations::Ci::Job::Unschedule mount_mutation Mutations::Ci::JobTokenScope::AddProject mount_mutation Mutations::Ci::JobTokenScope::RemoveProject mount_mutation Mutations::Ci::Runner::Update, feature_flag: :runner_graphql_query mount_mutation Mutations::Ci::Runner::Delete, feature_flag: :runner_graphql_query mount_mutation Mutations::Ci::RunnersRegistrationToken::Reset, feature_flag: :runner_graphql_query mount_mutation Mutations::Namespace::PackageSettings::Update + mount_mutation Mutations::Groups::Update mount_mutation Mutations::UserCallouts::Create mount_mutation Mutations::Packages::Destroy + mount_mutation Mutations::Packages::DestroyFile mount_mutation Mutations::Echo end end diff --git a/app/graphql/types/namespace/package_settings_type.rb b/app/graphql/types/namespace/package_settings_type.rb index af091515979..d573cc9ded5 100644 --- a/app/graphql/types/namespace/package_settings_type.rb +++ b/app/graphql/types/namespace/package_settings_type.rb @@ -8,9 +8,9 @@ module Types authorize :read_package_settings - field :maven_duplicates_allowed, GraphQL::BOOLEAN_TYPE, null: false, description: 'Indicates whether duplicate Maven packages are allowed for this namespace.' + field :maven_duplicates_allowed, GraphQL::Types::Boolean, null: false, description: 'Indicates whether duplicate Maven packages are allowed for this namespace.' field :maven_duplicate_exception_regex, Types::UntrustedRegexp, null: true, description: 'When maven_duplicates_allowed is false, you can publish duplicate packages with names that match this regex. Otherwise, this setting has no effect.' - field :generic_duplicates_allowed, GraphQL::BOOLEAN_TYPE, null: false, description: 'Indicates whether duplicate generic packages are allowed for this namespace.' + field :generic_duplicates_allowed, GraphQL::Types::Boolean, null: false, description: 'Indicates whether duplicate generic packages are allowed for this namespace.' field :generic_duplicate_exception_regex, Types::UntrustedRegexp, null: true, description: 'When generic_duplicates_allowed is false, you can publish duplicate packages with names that match this regex. Otherwise, this setting has no effect.' end end diff --git a/app/graphql/types/namespace/shared_runners_setting_enum.rb b/app/graphql/types/namespace/shared_runners_setting_enum.rb new file mode 100644 index 00000000000..4773e414aeb --- /dev/null +++ b/app/graphql/types/namespace/shared_runners_setting_enum.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Types + class Namespace::SharedRunnersSettingEnum < BaseEnum + graphql_name 'SharedRunnersSetting' + + ::Namespace::SHARED_RUNNERS_SETTINGS.each do |type| + value type.upcase, + description: "Sharing of runners is #{type.tr('_', ' ')}.", + value: type + end + end +end diff --git a/app/graphql/types/namespace_type.rb b/app/graphql/types/namespace_type.rb index 96eff8a46b0..4cc543f477a 100644 --- a/app/graphql/types/namespace_type.rb +++ b/app/graphql/types/namespace_type.rb @@ -6,27 +6,27 @@ module Types authorize :read_namespace - field :id, GraphQL::ID_TYPE, null: false, + field :id, GraphQL::Types::ID, null: false, description: 'ID of the namespace.' - field :name, GraphQL::STRING_TYPE, null: false, + field :name, GraphQL::Types::String, null: false, description: 'Name of the namespace.' - field :path, GraphQL::STRING_TYPE, null: false, + field :path, GraphQL::Types::String, null: false, description: 'Path of the namespace.' - field :full_name, GraphQL::STRING_TYPE, null: false, + field :full_name, GraphQL::Types::String, null: false, description: 'Full name of the namespace.' - field :full_path, GraphQL::ID_TYPE, null: false, + field :full_path, GraphQL::Types::ID, null: false, description: 'Full path of the namespace.' - field :description, GraphQL::STRING_TYPE, null: true, + field :description, GraphQL::Types::String, null: true, description: 'Description of the namespace.' markdown_field :description_html, null: true - field :visibility, GraphQL::STRING_TYPE, null: true, + field :visibility, GraphQL::Types::String, null: true, description: 'Visibility of the namespace.' - field :lfs_enabled, GraphQL::BOOLEAN_TYPE, null: true, method: :lfs_enabled?, + field :lfs_enabled, GraphQL::Types::Boolean, null: true, method: :lfs_enabled?, description: 'Indicates if Large File Storage (LFS) is enabled for namespace.' - field :request_access_enabled, GraphQL::BOOLEAN_TYPE, null: true, + field :request_access_enabled, GraphQL::Types::Boolean, null: true, description: 'Indicates if users can request access to namespace.' field :root_storage_statistics, Types::RootStorageStatisticsType, @@ -42,6 +42,11 @@ module Types null: true, description: 'The package settings for the namespace.' + field :shared_runners_setting, + Types::Namespace::SharedRunnersSettingEnum, + null: true, + description: "Shared runners availability for the namespace and its descendants." + def root_storage_statistics Gitlab::Graphql::Loaders::BatchRootStorageStatisticsLoader.new(object.id).find end diff --git a/app/graphql/types/negated_milestone_wildcard_id_enum.rb b/app/graphql/types/negated_milestone_wildcard_id_enum.rb new file mode 100644 index 00000000000..ca27a6c7b6e --- /dev/null +++ b/app/graphql/types/negated_milestone_wildcard_id_enum.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Types + class NegatedMilestoneWildcardIdEnum < BaseEnum + graphql_name 'NegatedMilestoneWildcardId' + description 'Negated Milestone ID wildcard values' + + value 'STARTED', 'An open, started milestone (start date <= today).' + value 'UPCOMING', 'An open milestone due in the future (due date >= today).' + end +end diff --git a/app/graphql/types/notes/diff_image_position_input_type.rb b/app/graphql/types/notes/diff_image_position_input_type.rb index dd5c8f20cc3..d56c67bbec8 100644 --- a/app/graphql/types/notes/diff_image_position_input_type.rb +++ b/app/graphql/types/notes/diff_image_position_input_type.rb @@ -5,13 +5,13 @@ module Types class DiffImagePositionInputType < DiffPositionBaseInputType graphql_name 'DiffImagePositionInput' - argument :x, GraphQL::INT_TYPE, required: true, + argument :x, GraphQL::Types::Int, required: true, description: copy_field_description(Types::Notes::DiffPositionType, :x) - argument :y, GraphQL::INT_TYPE, required: true, + argument :y, GraphQL::Types::Int, required: true, description: copy_field_description(Types::Notes::DiffPositionType, :y) - argument :width, GraphQL::INT_TYPE, required: true, + argument :width, GraphQL::Types::Int, required: true, description: copy_field_description(Types::Notes::DiffPositionType, :width) - argument :height, GraphQL::INT_TYPE, required: true, + argument :height, GraphQL::Types::Int, required: true, description: copy_field_description(Types::Notes::DiffPositionType, :height) end end diff --git a/app/graphql/types/notes/diff_position_base_input_type.rb b/app/graphql/types/notes/diff_position_base_input_type.rb index c8f9f9028cc..e773fbbc8a1 100644 --- a/app/graphql/types/notes/diff_position_base_input_type.rb +++ b/app/graphql/types/notes/diff_position_base_input_type.rb @@ -3,11 +3,11 @@ module Types module Notes class DiffPositionBaseInputType < BaseInputObject - argument :head_sha, GraphQL::STRING_TYPE, required: true, + argument :head_sha, GraphQL::Types::String, required: true, description: copy_field_description(Types::DiffRefsType, :head_sha) - argument :base_sha, GraphQL::STRING_TYPE, required: false, + argument :base_sha, GraphQL::Types::String, required: false, description: copy_field_description(Types::DiffRefsType, :base_sha) - argument :start_sha, GraphQL::STRING_TYPE, required: true, + argument :start_sha, GraphQL::Types::String, required: true, description: copy_field_description(Types::DiffRefsType, :start_sha) argument :paths, diff --git a/app/graphql/types/notes/diff_position_input_type.rb b/app/graphql/types/notes/diff_position_input_type.rb index 7ec5fd9e086..18ce6672d14 100644 --- a/app/graphql/types/notes/diff_position_input_type.rb +++ b/app/graphql/types/notes/diff_position_input_type.rb @@ -5,9 +5,9 @@ module Types class DiffPositionInputType < DiffPositionBaseInputType graphql_name 'DiffPositionInput' - argument :old_line, GraphQL::INT_TYPE, required: false, + argument :old_line, GraphQL::Types::Int, required: false, description: copy_field_description(Types::Notes::DiffPositionType, :old_line) - argument :new_line, GraphQL::INT_TYPE, required: false, + argument :new_line, GraphQL::Types::Int, required: false, description: copy_field_description(Types::Notes::DiffPositionType, :new_line) end end diff --git a/app/graphql/types/notes/diff_position_type.rb b/app/graphql/types/notes/diff_position_type.rb index 67747a13dcf..9c756d56b97 100644 --- a/app/graphql/types/notes/diff_position_type.rb +++ b/app/graphql/types/notes/diff_position_type.rb @@ -10,29 +10,29 @@ module Types field :diff_refs, Types::DiffRefsType, null: false, description: 'Information about the branch, HEAD, and base at the time of commenting.' - field :file_path, GraphQL::STRING_TYPE, null: false, + field :file_path, GraphQL::Types::String, null: false, description: 'Path of the file that was changed.' - field :old_path, GraphQL::STRING_TYPE, null: true, + field :old_path, GraphQL::Types::String, null: true, description: 'Path of the file on the start SHA.' - field :new_path, GraphQL::STRING_TYPE, null: true, + field :new_path, GraphQL::Types::String, null: true, description: 'Path of the file on the HEAD SHA.' field :position_type, Types::Notes::PositionTypeEnum, null: false, description: 'Type of file the position refers to.' # Fields for text positions - field :old_line, GraphQL::INT_TYPE, null: true, + field :old_line, GraphQL::Types::Int, null: true, description: 'Line on start SHA that was changed.' - field :new_line, GraphQL::INT_TYPE, null: true, + field :new_line, GraphQL::Types::Int, null: true, description: 'Line on HEAD SHA that was changed.' # Fields for image positions - field :x, GraphQL::INT_TYPE, null: true, + field :x, GraphQL::Types::Int, null: true, description: 'X position of the note.' - field :y, GraphQL::INT_TYPE, null: true, + field :y, GraphQL::Types::Int, null: true, description: 'Y position of the note.' - field :width, GraphQL::INT_TYPE, null: true, + field :width, GraphQL::Types::Int, null: true, description: 'Total width of the image.' - field :height, GraphQL::INT_TYPE, null: true, + field :height, GraphQL::Types::Int, null: true, description: 'Total height of the image.' def old_line diff --git a/app/graphql/types/notes/note_type.rb b/app/graphql/types/notes/note_type.rb index 751cf7c10f1..fa33428114c 100644 --- a/app/graphql/types/notes/note_type.rb +++ b/app/graphql/types/notes/note_type.rb @@ -22,13 +22,13 @@ module Types null: false, description: 'User who wrote this note.' - field :system, GraphQL::BOOLEAN_TYPE, + field :system, GraphQL::Types::Boolean, null: false, description: 'Indicates whether this note was created by the system or by a user.' - field :system_note_icon_name, GraphQL::STRING_TYPE, null: true, + field :system_note_icon_name, GraphQL::Types::String, null: true, description: 'Name of the icon corresponding to a system note.' - field :body, GraphQL::STRING_TYPE, + field :body, GraphQL::Types::String, null: false, method: :note, description: 'Content of the note.' @@ -43,10 +43,10 @@ module Types description: 'The discussion this note is a part of.' field :position, Types::Notes::DiffPositionType, null: true, description: 'The position of this note on a diff.' - field :confidential, GraphQL::BOOLEAN_TYPE, null: true, + field :confidential, GraphQL::Types::Boolean, null: true, description: 'Indicates if this note is confidential.', method: :confidential? - field :url, GraphQL::STRING_TYPE, + field :url, GraphQL::Types::String, null: true, description: 'URL to view this Note in the Web UI.' diff --git a/app/graphql/types/notes/update_diff_image_position_input_type.rb b/app/graphql/types/notes/update_diff_image_position_input_type.rb index ab27f6b9ad3..0c6e4a16434 100644 --- a/app/graphql/types/notes/update_diff_image_position_input_type.rb +++ b/app/graphql/types/notes/update_diff_image_position_input_type.rb @@ -6,19 +6,19 @@ module Types class UpdateDiffImagePositionInputType < BaseInputObject graphql_name 'UpdateDiffImagePositionInput' - argument :x, GraphQL::INT_TYPE, + argument :x, GraphQL::Types::Int, required: false, description: copy_field_description(Types::Notes::DiffPositionType, :x) - argument :y, GraphQL::INT_TYPE, + argument :y, GraphQL::Types::Int, required: false, description: copy_field_description(Types::Notes::DiffPositionType, :y) - argument :width, GraphQL::INT_TYPE, + argument :width, GraphQL::Types::Int, required: false, description: copy_field_description(Types::Notes::DiffPositionType, :width) - argument :height, GraphQL::INT_TYPE, + argument :height, GraphQL::Types::Int, required: false, description: copy_field_description(Types::Notes::DiffPositionType, :height) diff --git a/app/graphql/types/packages/composer/json_type.rb b/app/graphql/types/packages/composer/json_type.rb index b7aa32f0170..d2bd62ca74d 100644 --- a/app/graphql/types/packages/composer/json_type.rb +++ b/app/graphql/types/packages/composer/json_type.rb @@ -8,10 +8,10 @@ module Types graphql_name 'PackageComposerJsonType' description 'Represents a composer JSON file' - field :name, GraphQL::STRING_TYPE, null: true, description: 'The name set in the Composer JSON file.' - field :type, GraphQL::STRING_TYPE, null: true, description: 'The type set in the Composer JSON file.' - field :license, GraphQL::STRING_TYPE, null: true, description: 'The license set in the Composer JSON file.' - field :version, GraphQL::STRING_TYPE, null: true, description: 'The version set in the Composer JSON file.' + field :name, GraphQL::Types::String, null: true, description: 'The name set in the Composer JSON file.' + field :type, GraphQL::Types::String, null: true, description: 'The type set in the Composer JSON file.' + field :license, GraphQL::Types::String, null: true, description: 'The license set in the Composer JSON file.' + field :version, GraphQL::Types::String, null: true, description: 'The version set in the Composer JSON file.' end end end diff --git a/app/graphql/types/packages/composer/metadatum_type.rb b/app/graphql/types/packages/composer/metadatum_type.rb index 9d4ce3cebd4..092e729ec56 100644 --- a/app/graphql/types/packages/composer/metadatum_type.rb +++ b/app/graphql/types/packages/composer/metadatum_type.rb @@ -9,7 +9,7 @@ module Types authorize :read_package - field :target_sha, GraphQL::STRING_TYPE, null: false, description: 'Target SHA of the package.' + field :target_sha, GraphQL::Types::String, null: false, description: 'Target SHA of the package.' field :composer_json, Types::Packages::Composer::JsonType, null: false, description: 'Data of the Composer JSON file.' end end diff --git a/app/graphql/types/packages/conan/file_metadatum_type.rb b/app/graphql/types/packages/conan/file_metadatum_type.rb index 97d5abe6ba4..9a26fd5de51 100644 --- a/app/graphql/types/packages/conan/file_metadatum_type.rb +++ b/app/graphql/types/packages/conan/file_metadatum_type.rb @@ -12,9 +12,9 @@ module Types authorize :read_package field :id, ::Types::GlobalIDType[::Packages::Conan::FileMetadatum], null: false, description: 'ID of the metadatum.' - field :recipe_revision, GraphQL::STRING_TYPE, null: false, description: 'Revision of the Conan recipe.' - field :package_revision, GraphQL::STRING_TYPE, null: true, description: 'Revision of the package.' - field :conan_package_reference, GraphQL::STRING_TYPE, null: true, description: 'Reference of the Conan package.' + field :recipe_revision, GraphQL::Types::String, null: false, description: 'Revision of the Conan recipe.' + field :package_revision, GraphQL::Types::String, null: true, description: 'Revision of the package.' + field :conan_package_reference, GraphQL::Types::String, null: true, description: 'Reference of the Conan package.' field :conan_file_type, ::Types::Packages::Conan::MetadatumFileTypeEnum, null: false, description: 'Type of the Conan file.' end end diff --git a/app/graphql/types/packages/conan/metadatum_type.rb b/app/graphql/types/packages/conan/metadatum_type.rb index 00b84235d27..cdfd0aa4483 100644 --- a/app/graphql/types/packages/conan/metadatum_type.rb +++ b/app/graphql/types/packages/conan/metadatum_type.rb @@ -12,10 +12,10 @@ module Types field :id, ::Types::GlobalIDType[::Packages::Conan::Metadatum], null: false, description: 'ID of the metadatum.' field :created_at, Types::TimeType, null: false, description: 'Date of creation.' field :updated_at, Types::TimeType, null: false, description: 'Date of most recent update.' - field :package_username, GraphQL::STRING_TYPE, null: false, description: 'Username of the Conan package.' - field :package_channel, GraphQL::STRING_TYPE, null: false, description: 'Channel of the Conan package.' - field :recipe, GraphQL::STRING_TYPE, null: false, description: 'Recipe of the Conan package.' - field :recipe_path, GraphQL::STRING_TYPE, null: false, description: 'Recipe path of the Conan package.' + field :package_username, GraphQL::Types::String, null: false, description: 'Username of the Conan package.' + field :package_channel, GraphQL::Types::String, null: false, description: 'Channel of the Conan package.' + field :recipe, GraphQL::Types::String, null: false, description: 'Recipe of the Conan package.' + field :recipe_path, GraphQL::Types::String, null: false, description: 'Recipe path of the Conan package.' end end end diff --git a/app/graphql/types/packages/dependency_link_metadata_type.rb b/app/graphql/types/packages/dependency_link_metadata_type.rb new file mode 100644 index 00000000000..c13069c7889 --- /dev/null +++ b/app/graphql/types/packages/dependency_link_metadata_type.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +module Types + module Packages + class DependencyLinkMetadataType < BaseUnion + graphql_name 'DependencyLinkMetadata' + description 'Represents metadata associated with a dependency link' + + possible_types ::Types::Packages::Nuget::DependencyLinkMetadatumType + + def self.resolve_type(object, context) + case object + when ::Packages::Nuget::DependencyLinkMetadatum + ::Types::Packages::Nuget::DependencyLinkMetadatumType + else + # NOTE: This method must be kept in sync with `PackageDependencyLinkType#metadata`, + # which must never produce data that this discriminator cannot handle. + raise 'Unsupported metadata type' + end + end + end + end +end diff --git a/app/graphql/types/packages/maven/metadatum_type.rb b/app/graphql/types/packages/maven/metadatum_type.rb index bdb250ef96b..eb3829648d1 100644 --- a/app/graphql/types/packages/maven/metadatum_type.rb +++ b/app/graphql/types/packages/maven/metadatum_type.rb @@ -12,10 +12,10 @@ module Types field :id, ::Types::GlobalIDType[::Packages::Maven::Metadatum], null: false, description: 'ID of the metadatum.' field :created_at, Types::TimeType, null: false, description: 'Date of creation.' field :updated_at, Types::TimeType, null: false, description: 'Date of most recent update.' - field :path, GraphQL::STRING_TYPE, null: false, description: 'Path of the Maven package.' - field :app_group, GraphQL::STRING_TYPE, null: false, description: 'App group of the Maven package.' - field :app_version, GraphQL::STRING_TYPE, null: true, description: 'App version of the Maven package.' - field :app_name, GraphQL::STRING_TYPE, null: false, description: 'App name of the Maven package.' + field :path, GraphQL::Types::String, null: false, description: 'Path of the Maven package.' + field :app_group, GraphQL::Types::String, null: false, description: 'App group of the Maven package.' + field :app_version, GraphQL::Types::String, null: true, description: 'App version of the Maven package.' + field :app_name, GraphQL::Types::String, null: false, description: 'App name of the Maven package.' end end end diff --git a/app/graphql/types/packages/nuget/dependency_link_metadatum_type.rb b/app/graphql/types/packages/nuget/dependency_link_metadatum_type.rb new file mode 100644 index 00000000000..f410e62b56a --- /dev/null +++ b/app/graphql/types/packages/nuget/dependency_link_metadatum_type.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Types + module Packages + module Nuget + class DependencyLinkMetadatumType < BaseObject + graphql_name 'NugetDependencyLinkMetadata' + description 'Nuget dependency link metadata' + + authorize :read_package + + field :id, ::Types::GlobalIDType[::Packages::Nuget::DependencyLinkMetadatum], null: false, description: 'ID of the metadatum.' + field :target_framework, GraphQL::Types::String, null: false, description: 'Target framework of the dependency link package.' + end + end + end +end diff --git a/app/graphql/types/packages/nuget/metadatum_type.rb b/app/graphql/types/packages/nuget/metadatum_type.rb index 63fae2fb197..ed9d97724af 100644 --- a/app/graphql/types/packages/nuget/metadatum_type.rb +++ b/app/graphql/types/packages/nuget/metadatum_type.rb @@ -10,9 +10,9 @@ module Types authorize :read_package field :id, ::Types::GlobalIDType[::Packages::Nuget::Metadatum], null: false, description: 'ID of the metadatum.' - field :license_url, GraphQL::STRING_TYPE, null: false, description: 'License URL of the Nuget package.' - field :project_url, GraphQL::STRING_TYPE, null: false, description: 'Project URL of the Nuget package.' - field :icon_url, GraphQL::STRING_TYPE, null: false, description: 'Icon URL of the Nuget package.' + field :license_url, GraphQL::Types::String, null: false, description: 'License URL of the Nuget package.' + field :project_url, GraphQL::Types::String, null: false, description: 'Project URL of the Nuget package.' + field :icon_url, GraphQL::Types::String, null: false, description: 'Icon URL of the Nuget package.' end end end diff --git a/app/graphql/types/packages/package_dependency_link_type.rb b/app/graphql/types/packages/package_dependency_link_type.rb new file mode 100644 index 00000000000..eceb8319748 --- /dev/null +++ b/app/graphql/types/packages/package_dependency_link_type.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +module Types + module Packages + class PackageDependencyLinkType < BaseObject + graphql_name 'PackageDependencyLink' + description 'Represents a package dependency link' + authorize :read_package + + field :id, ::Types::GlobalIDType[::Packages::DependencyLink], null: false, description: 'ID of the dependency link.' + field :dependency_type, Types::Packages::PackageDependencyTypeEnum, null: false, description: 'Dependency type.' + field :dependency, Types::Packages::PackageDependencyType, null: true, description: 'Dependency.' + field :metadata, Types::Packages::DependencyLinkMetadataType, null: true, description: 'Dependency link metadata.' + + # NOTE: This method must be kept in sync with the union + # type: `Types::Packages::DependencyLinkMetadata`. + # + # `Types::Packages::DependencyLinkMetadata.resolve_type(metadata, ctx)` must never raise. + def metadata + model_class = case object.package.package_type + when 'nuget' + ::Packages::Nuget::DependencyLinkMetadatum + end + + return unless model_class + + # rubocop: disable CodeReuse/ActiveRecord + BatchLoader::GraphQL.for(object.id).batch do |ids, loader| + results = model_class.where(dependency_link_id: ids) + results.each { |record| loader.call(record.dependency_link_id, record) } + end + # rubocop: enable CodeReuse/ActiveRecord + end + + def dependency + ::Gitlab::Graphql::Loaders::BatchModelLoader.new(::Packages::Dependency, object.dependency_id).find + end + end + end +end diff --git a/app/graphql/types/packages/package_dependency_type.rb b/app/graphql/types/packages/package_dependency_type.rb new file mode 100644 index 00000000000..dcbc9fa3784 --- /dev/null +++ b/app/graphql/types/packages/package_dependency_type.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true +# this model does not have any kind of authorization so we disable it +# rubocop:disable Graphql/AuthorizeTypes + +module Types + module Packages + class PackageDependencyType < BaseObject + graphql_name 'PackageDependency' + description 'Represents a package dependency.' + + field :id, ::Types::GlobalIDType[::Packages::Dependency], null: false, description: 'ID of the dependency.' + field :name, GraphQL::Types::String, null: false, description: 'Name of the dependency.' + field :version_pattern, GraphQL::Types::String, null: false, description: 'Version pattern of the dependency.' + end + end +end diff --git a/app/graphql/types/packages/package_dependency_type_enum.rb b/app/graphql/types/packages/package_dependency_type_enum.rb new file mode 100644 index 00000000000..0e98d149b9a --- /dev/null +++ b/app/graphql/types/packages/package_dependency_type_enum.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Types + module Packages + class PackageDependencyTypeEnum < BaseEnum + graphql_name 'PackageDependencyType' + + ::Packages::DependencyLink.dependency_types.keys.each do |type| + value type.to_s.underscore.upcase, description: "#{type} dependency type", value: type.to_s + end + end + end +end diff --git a/app/graphql/types/packages/package_details_type.rb b/app/graphql/types/packages/package_details_type.rb index 510b7e2ba41..f52b1f02519 100644 --- a/app/graphql/types/packages/package_details_type.rb +++ b/app/graphql/types/packages/package_details_type.rb @@ -12,6 +12,8 @@ module Types field :package_files, Types::Packages::PackageFileType.connection_type, null: true, description: 'Package files.' + field :dependency_links, Types::Packages::PackageDependencyLinkType.connection_type, null: true, description: 'Dependency link.' + def versions object.versions end diff --git a/app/graphql/types/packages/package_file_type.rb b/app/graphql/types/packages/package_file_type.rb index e9e38559626..f77c40de8d8 100644 --- a/app/graphql/types/packages/package_file_type.rb +++ b/app/graphql/types/packages/package_file_type.rb @@ -10,12 +10,12 @@ module Types field :id, ::Types::GlobalIDType[::Packages::PackageFile], null: false, description: 'ID of the file.' field :created_at, Types::TimeType, null: false, description: 'The created date.' field :updated_at, Types::TimeType, null: false, description: 'The updated date.' - field :size, GraphQL::STRING_TYPE, null: false, description: 'Size of the package file.' - field :file_name, GraphQL::STRING_TYPE, null: false, description: 'Name of the package file.' - field :download_path, GraphQL::STRING_TYPE, null: false, description: 'Download path of the package file.' - field :file_md5, GraphQL::STRING_TYPE, null: true, description: 'Md5 of the package file.' - field :file_sha1, GraphQL::STRING_TYPE, null: true, description: 'Sha1 of the package file.' - field :file_sha256, GraphQL::STRING_TYPE, null: true, description: 'Sha256 of the package file.' + field :size, GraphQL::Types::String, null: false, description: 'Size of the package file.' + field :file_name, GraphQL::Types::String, null: false, description: 'Name of the package file.' + field :download_path, GraphQL::Types::String, null: false, description: 'Download path of the package file.' + field :file_md5, GraphQL::Types::String, null: true, description: 'Md5 of the package file.' + field :file_sha1, GraphQL::Types::String, null: true, description: 'Sha1 of the package file.' + field :file_sha256, GraphQL::Types::String, null: true, description: 'Sha256 of the package file.' field :file_metadata, Types::Packages::FileMetadataType, null: true, description: 'File metadata.' diff --git a/app/graphql/types/packages/package_tag_type.rb b/app/graphql/types/packages/package_tag_type.rb index a05ce03da67..450f3fc8e9c 100644 --- a/app/graphql/types/packages/package_tag_type.rb +++ b/app/graphql/types/packages/package_tag_type.rb @@ -7,8 +7,8 @@ module Types description 'Represents a package tag' authorize :read_package - field :id, GraphQL::ID_TYPE, null: false, description: 'The ID of the tag.' - field :name, GraphQL::STRING_TYPE, null: false, description: 'The name of the tag.' + field :id, GraphQL::Types::ID, null: false, description: 'The ID of the tag.' + field :name, GraphQL::Types::String, null: false, description: 'The name of the tag.' field :created_at, Types::TimeType, null: false, description: 'The created date.' field :updated_at, Types::TimeType, null: false, description: 'The updated date.' end diff --git a/app/graphql/types/packages/package_type.rb b/app/graphql/types/packages/package_type.rb index ee6785e3555..b8654ebd2c6 100644 --- a/app/graphql/types/packages/package_type.rb +++ b/app/graphql/types/packages/package_type.rb @@ -11,10 +11,10 @@ module Types field :id, ::Types::GlobalIDType[::Packages::Package], null: false, description: 'ID of the package.' - field :name, GraphQL::STRING_TYPE, null: false, description: 'Name of the package.' + field :name, GraphQL::Types::String, null: false, description: 'Name of the package.' field :created_at, Types::TimeType, null: false, description: 'Date of creation.' field :updated_at, Types::TimeType, null: false, description: 'Date of most recent update.' - field :version, GraphQL::STRING_TYPE, null: true, description: 'Version string.' + field :version, GraphQL::Types::String, null: true, description: 'Version string.' field :package_type, Types::Packages::PackageTypeEnum, null: false, description: 'Package type.' field :tags, Types::Packages::PackageTagType.connection_type, null: true, description: 'Package tags.' field :project, Types::ProjectType, null: false, description: 'Project where the package is stored.' diff --git a/app/graphql/types/packages/pypi/metadatum_type.rb b/app/graphql/types/packages/pypi/metadatum_type.rb index 031d3572197..63452d8ab6e 100644 --- a/app/graphql/types/packages/pypi/metadatum_type.rb +++ b/app/graphql/types/packages/pypi/metadatum_type.rb @@ -10,7 +10,7 @@ module Types authorize :read_package field :id, ::Types::GlobalIDType[::Packages::Pypi::Metadatum], null: false, description: 'ID of the metadatum.' - field :required_python, GraphQL::STRING_TYPE, null: true, description: 'Required Python version of the Pypi package.' + field :required_python, GraphQL::Types::String, null: true, description: 'Required Python version of the Pypi package.' end end end diff --git a/app/graphql/types/permission_types/base_permission_type.rb b/app/graphql/types/permission_types/base_permission_type.rb index deb8560bd79..a2cefb872c9 100644 --- a/app/graphql/types/permission_types/base_permission_type.rb +++ b/app/graphql/types/permission_types/base_permission_type.rb @@ -24,7 +24,7 @@ module Types def self.permission_field(name, **kword_args) kword_args = kword_args.reverse_merge( name: name, - type: GraphQL::BOOLEAN_TYPE, + type: GraphQL::Types::Boolean, description: "Indicates the user can perform `#{name}` on this resource", null: false) diff --git a/app/graphql/types/project_type.rb b/app/graphql/types/project_type.rb index 968635f9e6e..af1f1c54ec2 100644 --- a/app/graphql/types/project_type.rb +++ b/app/graphql/types/project_type.rb @@ -8,44 +8,44 @@ module Types expose_permissions Types::PermissionTypes::Project - field :id, GraphQL::ID_TYPE, null: false, + field :id, GraphQL::Types::ID, null: false, description: 'ID of the project.' - field :full_path, GraphQL::ID_TYPE, null: false, + field :full_path, GraphQL::Types::ID, null: false, description: 'Full path of the project.' - field :path, GraphQL::STRING_TYPE, null: false, + field :path, GraphQL::Types::String, null: false, description: 'Path of the project.' field :sast_ci_configuration, Types::CiConfiguration::Sast::Type, null: true, calls_gitaly: true, description: 'SAST CI configuration for the project.' - field :name_with_namespace, GraphQL::STRING_TYPE, null: false, + field :name_with_namespace, GraphQL::Types::String, null: false, description: 'Full name of the project with its namespace.' - field :name, GraphQL::STRING_TYPE, null: false, + field :name, GraphQL::Types::String, null: false, description: 'Name of the project (without namespace).' - field :description, GraphQL::STRING_TYPE, null: true, + field :description, GraphQL::Types::String, null: true, description: 'Short description of the project.' markdown_field :description_html, null: true - field :tag_list, GraphQL::STRING_TYPE, null: true, + field :tag_list, GraphQL::Types::String, null: true, deprecated: { reason: 'Use `topics`', milestone: '13.12' }, description: 'List of project topics (not Git tags).' - field :topics, [GraphQL::STRING_TYPE], null: true, + field :topics, [GraphQL::Types::String], null: true, description: 'List of project topics.' - field :ssh_url_to_repo, GraphQL::STRING_TYPE, null: true, + field :ssh_url_to_repo, GraphQL::Types::String, null: true, description: 'URL to connect to the project via SSH.' - field :http_url_to_repo, GraphQL::STRING_TYPE, null: true, + field :http_url_to_repo, GraphQL::Types::String, null: true, description: 'URL to connect to the project via HTTPS.' - field :web_url, GraphQL::STRING_TYPE, null: true, + field :web_url, GraphQL::Types::String, null: true, description: 'Web URL of the project.' - field :star_count, GraphQL::INT_TYPE, null: false, + field :star_count, GraphQL::Types::Int, null: false, description: 'Number of times the project has been starred.' - field :forks_count, GraphQL::INT_TYPE, null: false, calls_gitaly: true, # 4 times + field :forks_count, GraphQL::Types::Int, null: false, calls_gitaly: true, # 4 times description: 'Number of times the project has been forked.' field :created_at, Types::TimeType, null: true, @@ -53,26 +53,26 @@ module Types field :last_activity_at, Types::TimeType, null: true, description: 'Timestamp of the project last activity.' - field :archived, GraphQL::BOOLEAN_TYPE, null: true, + field :archived, GraphQL::Types::Boolean, null: true, description: 'Indicates the archived status of the project.' - field :visibility, GraphQL::STRING_TYPE, null: true, + field :visibility, GraphQL::Types::String, null: true, description: 'Visibility of the project.' - field :shared_runners_enabled, GraphQL::BOOLEAN_TYPE, null: true, + field :shared_runners_enabled, GraphQL::Types::Boolean, null: true, description: 'Indicates if shared runners are enabled for the project.' - field :lfs_enabled, GraphQL::BOOLEAN_TYPE, null: true, + field :lfs_enabled, GraphQL::Types::Boolean, null: true, description: 'Indicates if the project has Large File Storage (LFS) enabled.' - field :merge_requests_ff_only_enabled, GraphQL::BOOLEAN_TYPE, null: true, + field :merge_requests_ff_only_enabled, GraphQL::Types::Boolean, null: true, description: 'Indicates if no merge commits should be created and all merges should instead be fast-forwarded, which means that merging is only allowed if the branch could be fast-forwarded.' - field :service_desk_enabled, GraphQL::BOOLEAN_TYPE, null: true, + field :service_desk_enabled, GraphQL::Types::Boolean, null: true, description: 'Indicates if the project has service desk enabled.' - field :service_desk_address, GraphQL::STRING_TYPE, null: true, + field :service_desk_address, GraphQL::Types::String, null: true, description: 'E-mail address of the service desk.' - field :avatar_url, GraphQL::STRING_TYPE, null: true, calls_gitaly: true, + field :avatar_url, GraphQL::Types::String, null: true, calls_gitaly: true, description: 'URL to avatar image file of the project.' { @@ -82,7 +82,7 @@ module Types snippets: 'Snippets are', container_registry: 'Container Registry is' }.each do |feature, name_string| - field "#{feature}_enabled", GraphQL::BOOLEAN_TYPE, null: true, + field "#{feature}_enabled", GraphQL::Types::Boolean, null: true, description: "Indicates if #{name_string} enabled for the current user" define_method "#{feature}_enabled" do @@ -90,36 +90,36 @@ module Types end end - field :jobs_enabled, GraphQL::BOOLEAN_TYPE, null: true, + field :jobs_enabled, GraphQL::Types::Boolean, null: true, description: 'Indicates if CI/CD pipeline jobs are enabled for the current user.' - field :public_jobs, GraphQL::BOOLEAN_TYPE, method: :public_builds, null: true, + field :public_jobs, GraphQL::Types::Boolean, method: :public_builds, null: true, description: 'Indicates if there is public access to pipelines and job details of the project, including output logs and artifacts.' - field :open_issues_count, GraphQL::INT_TYPE, null: true, + field :open_issues_count, GraphQL::Types::Int, null: true, description: 'Number of open issues for the project.' - field :import_status, GraphQL::STRING_TYPE, null: true, + field :import_status, GraphQL::Types::String, null: true, description: 'Status of import background job of the project.' - field :jira_import_status, GraphQL::STRING_TYPE, null: true, + field :jira_import_status, GraphQL::Types::String, null: true, description: 'Status of Jira import background job of the project.' - field :only_allow_merge_if_pipeline_succeeds, GraphQL::BOOLEAN_TYPE, null: true, + field :only_allow_merge_if_pipeline_succeeds, GraphQL::Types::Boolean, null: true, description: 'Indicates if merge requests of the project can only be merged with successful jobs.' - field :allow_merge_on_skipped_pipeline, GraphQL::BOOLEAN_TYPE, null: true, + field :allow_merge_on_skipped_pipeline, GraphQL::Types::Boolean, null: true, description: 'If `only_allow_merge_if_pipeline_succeeds` is true, indicates if merge requests of the project can also be merged with skipped jobs.' - field :request_access_enabled, GraphQL::BOOLEAN_TYPE, null: true, + field :request_access_enabled, GraphQL::Types::Boolean, null: true, description: 'Indicates if users can request member access to the project.' - field :only_allow_merge_if_all_discussions_are_resolved, GraphQL::BOOLEAN_TYPE, null: true, + field :only_allow_merge_if_all_discussions_are_resolved, GraphQL::Types::Boolean, null: true, description: 'Indicates if merge requests of the project can only be merged when all the discussions are resolved.' - field :printing_merge_request_link_enabled, GraphQL::BOOLEAN_TYPE, null: true, + field :printing_merge_request_link_enabled, GraphQL::Types::Boolean, null: true, description: 'Indicates if a link to create or view a merge request should display after a push to Git repositories of the project from the command line.' - field :remove_source_branch_after_merge, GraphQL::BOOLEAN_TYPE, null: true, + field :remove_source_branch_after_merge, GraphQL::Types::Boolean, null: true, description: 'Indicates if `Delete source branch` option should be enabled by default for all new merge requests of the project.' - field :autoclose_referenced_issues, GraphQL::BOOLEAN_TYPE, null: true, + field :autoclose_referenced_issues, GraphQL::Types::Boolean, null: true, description: 'Indicates if issues referenced by merge requests and commits within the default branch are closed automatically.' - field :suggestion_commit_message, GraphQL::STRING_TYPE, null: true, + field :suggestion_commit_message, GraphQL::Types::String, null: true, description: 'The commit message used to apply merge request suggestions.' - field :squash_read_only, GraphQL::BOOLEAN_TYPE, null: false, method: :squash_readonly?, + field :squash_read_only, GraphQL::Types::Boolean, null: false, method: :squash_readonly?, description: 'Indicates if `squashReadOnly` is enabled.' field :namespace, Types::NamespaceType, null: true, @@ -318,14 +318,14 @@ module Types description: 'Container repositories of the project.', resolver: Resolvers::ContainerRepositoriesResolver - field :container_repositories_count, GraphQL::INT_TYPE, null: false, + field :container_repositories_count, GraphQL::Types::Int, null: false, description: 'Number of container repositories in the project.' field :label, Types::LabelType, null: true, description: 'A label available on this project.' do - argument :title, GraphQL::STRING_TYPE, + argument :title, GraphQL::Types::String, required: true, description: 'Title of the label.' end @@ -354,6 +354,13 @@ module Types description: 'The CI Job Tokens scope of access.', resolver: Resolvers::Ci::JobTokenScopeResolver + field :timelogs, + Types::TimelogType.connection_type, null: true, + description: 'Time logged on issues and merge requests in the project.', + extras: [:lookahead], + complexity: 5, + resolver: ::Resolvers::TimelogResolver + def label(title:) BatchLoader::GraphQL.for(title).batch(key: project) do |titles, loader, args| LabelsFinder diff --git a/app/graphql/types/projects/service_type.rb b/app/graphql/types/projects/service_type.rb index 6f0dcd44cad..4a9e5dcbfe9 100644 --- a/app/graphql/types/projects/service_type.rb +++ b/app/graphql/types/projects/service_type.rb @@ -8,9 +8,9 @@ module Types # TODO: Add all the fields that we want to expose for the project services integrations # https://gitlab.com/gitlab-org/gitlab/-/issues/213088 - field :type, GraphQL::STRING_TYPE, null: true, + field :type, GraphQL::Types::String, null: true, description: 'Class name of the service.' - field :active, GraphQL::BOOLEAN_TYPE, null: true, + field :active, GraphQL::Types::Boolean, null: true, description: 'Indicates if the service is active.' definition_methods do diff --git a/app/graphql/types/projects/services/jira_project_type.rb b/app/graphql/types/projects/services/jira_project_type.rb index 90abce2b4c3..957ac91db6b 100644 --- a/app/graphql/types/projects/services/jira_project_type.rb +++ b/app/graphql/types/projects/services/jira_project_type.rb @@ -7,12 +7,12 @@ module Types class JiraProjectType < BaseObject graphql_name 'JiraProject' - field :key, GraphQL::STRING_TYPE, null: false, + field :key, GraphQL::Types::String, null: false, description: 'Key of the Jira project.' - field :project_id, GraphQL::INT_TYPE, null: false, + field :project_id, GraphQL::Types::Int, null: false, description: 'ID of the Jira project.', method: :id - field :name, GraphQL::STRING_TYPE, null: true, + field :name, GraphQL::Types::String, null: true, description: 'Name of the Jira project.' end # rubocop:enable Graphql/AuthorizeTypes diff --git a/app/graphql/types/prometheus_alert_type.rb b/app/graphql/types/prometheus_alert_type.rb index 8e800536675..8327848032a 100644 --- a/app/graphql/types/prometheus_alert_type.rb +++ b/app/graphql/types/prometheus_alert_type.rb @@ -9,11 +9,11 @@ module Types present_using PrometheusAlertPresenter - field :id, GraphQL::ID_TYPE, null: false, + field :id, GraphQL::Types::ID, null: false, description: 'ID of the alert condition.' field :humanized_text, - GraphQL::STRING_TYPE, + GraphQL::Types::String, null: false, description: 'The human-readable text of the alert condition.' end diff --git a/app/graphql/types/query_complexity_type.rb b/app/graphql/types/query_complexity_type.rb index 82809fac22f..3f58a15aef7 100644 --- a/app/graphql/types/query_complexity_type.rb +++ b/app/graphql/types/query_complexity_type.rb @@ -9,7 +9,7 @@ module Types alias_method :query, :object - field :limit, GraphQL::INT_TYPE, + field :limit, GraphQL::Types::Int, null: true, method: :max_complexity, see: { @@ -18,7 +18,7 @@ module Types }, description: 'GraphQL query complexity limit.' - field :score, GraphQL::INT_TYPE, + field :score, GraphQL::Types::Int, null: true, description: 'GraphQL query complexity score.' diff --git a/app/graphql/types/query_type.rb b/app/graphql/types/query_type.rb index d2c67aea95c..7e9cd615719 100644 --- a/app/graphql/types/query_type.rb +++ b/app/graphql/types/query_type.rb @@ -129,7 +129,14 @@ module Types description: "Find runners visible to the current user.", feature_flag: :runner_graphql_query - field :ci_config, resolver: Resolvers::Ci::ConfigResolver, complexity: 126 # AUTHENTICATED_COMPLEXITY / 2 + 1 + field :ci_config, resolver: Resolvers::Ci::ConfigResolver, complexity: 126 # AUTHENTICATED_MAX_COMPLEXITY / 2 + 1 + + field :timelogs, Types::TimelogType.connection_type, + null: true, + description: 'Find timelogs visible to the current user.', + extras: [:lookahead], + complexity: 5, + resolver: ::Resolvers::TimelogResolver def design_management DesignManagementObject.new(nil) diff --git a/app/graphql/types/release_asset_link_shared_input_arguments.rb b/app/graphql/types/release_asset_link_shared_input_arguments.rb index 4aa247e47cc..37a6cdd55c9 100644 --- a/app/graphql/types/release_asset_link_shared_input_arguments.rb +++ b/app/graphql/types/release_asset_link_shared_input_arguments.rb @@ -5,15 +5,15 @@ module Types extend ActiveSupport::Concern included do - argument :name, GraphQL::STRING_TYPE, + argument :name, GraphQL::Types::String, required: true, description: 'Name of the asset link.' - argument :url, GraphQL::STRING_TYPE, + argument :url, GraphQL::Types::String, required: true, description: 'URL of the asset link.' - argument :direct_asset_path, GraphQL::STRING_TYPE, + argument :direct_asset_path, GraphQL::Types::String, required: false, as: :filepath, description: 'Relative path for a direct asset link.' diff --git a/app/graphql/types/release_asset_link_type.rb b/app/graphql/types/release_asset_link_type.rb index 829e7e246db..02961f2f73f 100644 --- a/app/graphql/types/release_asset_link_type.rb +++ b/app/graphql/types/release_asset_link_type.rb @@ -7,20 +7,20 @@ module Types authorize :read_release - field :id, GraphQL::ID_TYPE, null: false, + field :id, GraphQL::Types::ID, null: false, description: 'ID of the link.' - field :name, GraphQL::STRING_TYPE, null: true, + field :name, GraphQL::Types::String, null: true, description: 'Name of the link.' - field :url, GraphQL::STRING_TYPE, null: true, + field :url, GraphQL::Types::String, null: true, 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::BOOLEAN_TYPE, null: true, method: :external?, + field :external, GraphQL::Types::Boolean, null: true, method: :external?, description: 'Indicates the link points to an external resource.' - field :direct_asset_url, GraphQL::STRING_TYPE, null: true, + field :direct_asset_url, GraphQL::Types::String, null: true, description: 'Direct asset URL of the link.' - field :direct_asset_path, GraphQL::STRING_TYPE, null: true, method: :filepath, + field :direct_asset_path, GraphQL::Types::String, null: true, method: :filepath, description: 'Relative path for the direct asset link.' def direct_asset_url diff --git a/app/graphql/types/release_assets_type.rb b/app/graphql/types/release_assets_type.rb index d847d9842d5..ea6ee0b5fd9 100644 --- a/app/graphql/types/release_assets_type.rb +++ b/app/graphql/types/release_assets_type.rb @@ -11,7 +11,7 @@ module Types present_using ReleasePresenter - field :count, GraphQL::INT_TYPE, null: true, method: :assets_count, + field :count, GraphQL::Types::Int, null: true, method: :assets_count, description: 'Number of assets of the release.' field :links, Types::ReleaseAssetLinkType.connection_type, null: true, method: :sorted_links, description: 'Asset links of the release.' diff --git a/app/graphql/types/release_links_type.rb b/app/graphql/types/release_links_type.rb index a51b80e1e13..7830e29f3cd 100644 --- a/app/graphql/types/release_links_type.rb +++ b/app/graphql/types/release_links_type.rb @@ -10,20 +10,20 @@ module Types present_using ReleasePresenter - field :self_url, GraphQL::STRING_TYPE, null: true, + field :self_url, GraphQL::Types::String, null: true, description: 'HTTP URL of the release.' - field :edit_url, GraphQL::STRING_TYPE, null: true, + field :edit_url, GraphQL::Types::String, null: true, description: "HTTP URL of the release's edit page.", authorize: :update_release - field :opened_merge_requests_url, GraphQL::STRING_TYPE, null: true, + 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`.' - field :merged_merge_requests_url, GraphQL::STRING_TYPE, 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`.' - field :closed_merge_requests_url, GraphQL::STRING_TYPE, null: true, + 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`.' - field :opened_issues_url, GraphQL::STRING_TYPE, 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`.' - field :closed_issues_url, GraphQL::STRING_TYPE, null: true, + field :closed_issues_url, GraphQL::Types::String, null: true, description: 'HTTP URL of the issues page, filtered by this release and `state=closed`.' end end diff --git a/app/graphql/types/release_source_type.rb b/app/graphql/types/release_source_type.rb index 10fc202514d..fd29a69d72a 100644 --- a/app/graphql/types/release_source_type.rb +++ b/app/graphql/types/release_source_type.rb @@ -7,9 +7,9 @@ module Types authorize :download_code - field :format, GraphQL::STRING_TYPE, null: true, + field :format, GraphQL::Types::String, null: true, description: 'Format of the source.' - field :url, GraphQL::STRING_TYPE, null: true, + field :url, GraphQL::Types::String, null: true, description: 'Download URL of the source.' end end diff --git a/app/graphql/types/release_type.rb b/app/graphql/types/release_type.rb index 81813a10a3e..5e8f00b2b0a 100644 --- a/app/graphql/types/release_type.rb +++ b/app/graphql/types/release_type.rb @@ -13,22 +13,22 @@ module Types present_using ReleasePresenter - field :tag_name, GraphQL::STRING_TYPE, null: true, method: :tag, + field :tag_name, GraphQL::Types::String, null: true, method: :tag, description: 'Name of the tag associated with the release.', authorize: :download_code - field :tag_path, GraphQL::STRING_TYPE, null: true, + field :tag_path, GraphQL::Types::String, null: true, description: 'Relative web path to the tag associated with the release.', authorize: :download_code - field :description, GraphQL::STRING_TYPE, null: true, + field :description, GraphQL::Types::String, null: true, description: 'Description (also known as "release notes") of the release.' markdown_field :description_html, null: true - field :name, GraphQL::STRING_TYPE, null: true, + field :name, GraphQL::Types::String, null: true, 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, description: 'Timestamp of when the release was released.' - field :upcoming_release, GraphQL::BOOLEAN_TYPE, null: true, method: :upcoming_release?, + field :upcoming_release, GraphQL::Types::Boolean, null: true, method: :upcoming_release?, description: 'Indicates the release is an upcoming release.' field :assets, Types::ReleaseAssetsType, null: true, method: :itself, description: 'Assets of the release.' diff --git a/app/graphql/types/repository/blob_type.rb b/app/graphql/types/repository/blob_type.rb index 8ed97d7e663..b6a1a91fd7a 100644 --- a/app/graphql/types/repository/blob_type.rb +++ b/app/graphql/types/repository/blob_type.rb @@ -8,67 +8,67 @@ module Types graphql_name 'RepositoryBlob' - field :id, GraphQL::ID_TYPE, null: false, + field :id, GraphQL::Types::ID, null: false, description: 'ID of the blob.' - field :oid, GraphQL::STRING_TYPE, null: false, method: :id, + field :oid, GraphQL::Types::String, null: false, method: :id, description: 'OID of the blob.' - field :path, GraphQL::STRING_TYPE, null: false, + field :path, GraphQL::Types::String, null: false, description: 'Path of the blob.' - field :name, GraphQL::STRING_TYPE, + field :name, GraphQL::Types::String, description: 'Blob name.', null: true - field :mode, type: GraphQL::STRING_TYPE, + field :mode, type: GraphQL::Types::String, description: 'Blob mode.', null: true - field :lfs_oid, GraphQL::STRING_TYPE, null: true, + field :lfs_oid, GraphQL::Types::String, null: true, calls_gitaly: true, description: 'LFS OID of the blob.' - field :web_path, GraphQL::STRING_TYPE, null: true, + field :web_path, GraphQL::Types::String, null: true, description: 'Web path of the blob.' - field :ide_edit_path, GraphQL::STRING_TYPE, null: true, + field :ide_edit_path, GraphQL::Types::String, null: true, description: 'Web path to edit this blob in the Web IDE.' - field :fork_and_edit_path, GraphQL::STRING_TYPE, null: true, + field :fork_and_edit_path, GraphQL::Types::String, null: true, description: 'Web path to edit this blob using a forked project.' - field :ide_fork_and_edit_path, GraphQL::STRING_TYPE, null: true, + field :ide_fork_and_edit_path, GraphQL::Types::String, null: true, description: 'Web path to edit this blob in the Web IDE using a forked project.' - field :size, GraphQL::INT_TYPE, null: true, + field :size, GraphQL::Types::Int, null: true, description: 'Size (in bytes) of the blob.' - field :raw_size, GraphQL::INT_TYPE, null: true, + field :raw_size, GraphQL::Types::Int, null: true, description: 'Size (in bytes) of the blob, or the blob target if stored externally.' - field :raw_blob, GraphQL::STRING_TYPE, null: true, method: :data, + field :raw_blob, GraphQL::Types::String, null: true, method: :data, description: 'The raw content of the blob.' - field :raw_text_blob, GraphQL::STRING_TYPE, null: true, method: :text_only_data, + field :raw_text_blob, GraphQL::Types::String, null: true, method: :text_only_data, description: 'The raw content of the blob, if the blob is text data.' - field :stored_externally, GraphQL::BOOLEAN_TYPE, null: true, method: :stored_externally?, + field :stored_externally, GraphQL::Types::Boolean, null: true, method: :stored_externally?, description: "Whether the blob's content is stored externally (for instance, in LFS)." - field :edit_blob_path, GraphQL::STRING_TYPE, null: true, + field :edit_blob_path, GraphQL::Types::String, null: true, description: 'Web path to edit the blob in the old-style editor.' - field :raw_path, GraphQL::STRING_TYPE, null: true, + field :raw_path, GraphQL::Types::String, null: true, description: 'Web path to download the raw blob.' - field :external_storage_url, GraphQL::STRING_TYPE, null: true, + field :external_storage_url, GraphQL::Types::String, null: true, description: 'Web path to download the raw blob via external storage, if enabled.' - field :replace_path, GraphQL::STRING_TYPE, null: true, + field :replace_path, GraphQL::Types::String, null: true, description: 'Web path to replace the blob content.' - field :file_type, GraphQL::STRING_TYPE, null: true, + field :file_type, GraphQL::Types::String, null: true, description: 'The expected format of the blob based on the extension.' field :simple_viewer, type: Types::BlobViewerType, @@ -79,12 +79,12 @@ module Types description: 'Blob content rich viewer.', null: true - field :plain_data, GraphQL::STRING_TYPE, + field :plain_data, GraphQL::Types::String, description: 'Blob plain highlighted data.', null: true, calls_gitaly: true - field :can_modify_blob, GraphQL::BOOLEAN_TYPE, null: true, method: :can_modify_blob?, + field :can_modify_blob, GraphQL::Types::Boolean, null: true, method: :can_modify_blob?, calls_gitaly: true, description: 'Whether the current user can modify the blob.' diff --git a/app/graphql/types/repository_type.rb b/app/graphql/types/repository_type.rb index 9d896888fa7..63d1eef5b59 100644 --- a/app/graphql/types/repository_type.rb +++ b/app/graphql/types/repository_type.rb @@ -6,20 +6,24 @@ module Types authorize :download_code - field :root_ref, GraphQL::STRING_TYPE, null: true, calls_gitaly: true, + field :root_ref, GraphQL::Types::String, null: true, calls_gitaly: true, description: 'Default branch of the repository.' - field :empty, GraphQL::BOOLEAN_TYPE, null: false, method: :empty?, calls_gitaly: true, + field :empty, GraphQL::Types::Boolean, null: false, method: :empty?, calls_gitaly: true, description: 'Indicates repository has no visible content.' - field :exists, GraphQL::BOOLEAN_TYPE, null: false, method: :exists?, calls_gitaly: true, + 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.', + feature_flag: :paginated_tree_graphql_query field :blobs, Types::Repository::BlobType.connection_type, null: true, resolver: Resolvers::BlobsResolver, calls_gitaly: true, description: 'Blobs contained within the repository' - field :branch_names, [GraphQL::STRING_TYPE], null: true, calls_gitaly: true, + field :branch_names, [GraphQL::Types::String], null: true, calls_gitaly: true, complexity: 170, description: 'Names of branches available in this repository that match the search pattern.', resolver: Resolvers::RepositoryBranchNamesResolver - field :disk_path, GraphQL::STRING_TYPE, + field :disk_path, GraphQL::Types::String, description: 'Shows a disk path of the repository.', null: true, authorize: :read_storage_disk_path diff --git a/app/graphql/types/resolvable_interface.rb b/app/graphql/types/resolvable_interface.rb index a9d745c2bc1..42784aa5e00 100644 --- a/app/graphql/types/resolvable_interface.rb +++ b/app/graphql/types/resolvable_interface.rb @@ -16,10 +16,10 @@ module Types Gitlab::Graphql::Loaders::BatchModelLoader.new(User, object.resolved_by_id).find end - field :resolved, GraphQL::BOOLEAN_TYPE, null: false, + field :resolved, GraphQL::Types::Boolean, null: false, description: 'Indicates if the object is resolved.', method: :resolved? - field :resolvable, GraphQL::BOOLEAN_TYPE, null: false, + field :resolvable, GraphQL::Types::Boolean, null: false, description: 'Indicates if the object can be resolved.', method: :resolvable? field :resolved_at, Types::TimeType, null: true, diff --git a/app/graphql/types/snippet_type.rb b/app/graphql/types/snippet_type.rb index 7606bdbc46d..c345aea08bd 100644 --- a/app/graphql/types/snippet_type.rb +++ b/app/graphql/types/snippet_type.rb @@ -17,7 +17,7 @@ module Types description: 'ID of the snippet.', null: false - field :title, GraphQL::STRING_TYPE, + field :title, GraphQL::Types::String, description: 'Title of the snippet.', null: false @@ -33,11 +33,11 @@ module Types description: 'The owner of the snippet.', null: true - field :file_name, GraphQL::STRING_TYPE, + field :file_name, GraphQL::Types::String, description: 'File Name of the snippet.', null: true - field :description, GraphQL::STRING_TYPE, + field :description, GraphQL::Types::String, description: 'Description of the snippet.', null: true @@ -53,11 +53,11 @@ module Types description: 'Timestamp this snippet was updated.', null: false - field :web_url, type: GraphQL::STRING_TYPE, + field :web_url, type: GraphQL::Types::String, description: 'Web URL of the snippet.', null: false - field :raw_url, type: GraphQL::STRING_TYPE, + field :raw_url, type: GraphQL::Types::String, description: 'Raw URL of the snippet.', null: false @@ -67,12 +67,12 @@ module Types null: true, resolver: Resolvers::Snippets::BlobsResolver - field :ssh_url_to_repo, type: GraphQL::STRING_TYPE, + field :ssh_url_to_repo, type: GraphQL::Types::String, description: 'SSH URL to the snippet repository.', calls_gitaly: true, null: true - field :http_url_to_repo, type: GraphQL::STRING_TYPE, + field :http_url_to_repo, type: GraphQL::Types::String, description: 'HTTP URL to the snippet repository.', calls_gitaly: true, null: true diff --git a/app/graphql/types/snippets/blob_action_input_type.rb b/app/graphql/types/snippets/blob_action_input_type.rb index 13eade3dcc4..45dc4be8451 100644 --- a/app/graphql/types/snippets/blob_action_input_type.rb +++ b/app/graphql/types/snippets/blob_action_input_type.rb @@ -10,15 +10,15 @@ module Types description: 'Type of input action.', required: true - argument :previous_path, GraphQL::STRING_TYPE, + argument :previous_path, GraphQL::Types::String, description: 'Previous path of the snippet file.', required: false - argument :file_path, GraphQL::STRING_TYPE, + argument :file_path, GraphQL::Types::String, description: 'Path of the snippet file.', required: true - argument :content, GraphQL::STRING_TYPE, + argument :content, GraphQL::Types::String, description: 'Snippet file content.', required: false end diff --git a/app/graphql/types/snippets/blob_type.rb b/app/graphql/types/snippets/blob_type.rb index 1335838935e..d5da271d936 100644 --- a/app/graphql/types/snippets/blob_type.rb +++ b/app/graphql/types/snippets/blob_type.rb @@ -8,36 +8,36 @@ module Types description 'Represents the snippet blob' present_using SnippetBlobPresenter - field :rich_data, GraphQL::STRING_TYPE, + field :rich_data, GraphQL::Types::String, description: 'Blob highlighted data.', null: true - field :plain_data, GraphQL::STRING_TYPE, + field :plain_data, GraphQL::Types::String, description: 'Blob plain highlighted data.', null: true - field :raw_plain_data, GraphQL::STRING_TYPE, + field :raw_plain_data, GraphQL::Types::String, description: 'The raw content of the blob, if the blob is text data.', null: true - field :raw_path, GraphQL::STRING_TYPE, + field :raw_path, GraphQL::Types::String, description: 'Blob raw content endpoint path.', null: false - field :size, GraphQL::INT_TYPE, + field :size, GraphQL::Types::Int, description: 'Blob size.', null: false - field :binary, GraphQL::BOOLEAN_TYPE, + field :binary, GraphQL::Types::Boolean, description: 'Shows whether the blob is binary.', method: :binary?, null: false - field :name, GraphQL::STRING_TYPE, + field :name, GraphQL::Types::String, description: 'Blob name.', null: true - field :path, GraphQL::STRING_TYPE, + field :path, GraphQL::Types::String, description: 'Blob path.', null: true @@ -49,15 +49,15 @@ module Types description: 'Blob content rich viewer.', null: true - field :mode, type: GraphQL::STRING_TYPE, + field :mode, type: GraphQL::Types::String, description: 'Blob mode.', null: true - field :external_storage, type: GraphQL::STRING_TYPE, + field :external_storage, type: GraphQL::Types::String, description: 'Blob external storage.', null: true - field :rendered_as_text, type: GraphQL::BOOLEAN_TYPE, + field :rendered_as_text, type: GraphQL::Types::Boolean, description: 'Shows whether the blob is rendered as text.', method: :rendered_as_text?, null: false diff --git a/app/graphql/types/task_completion_status.rb b/app/graphql/types/task_completion_status.rb index 6837256f202..3aa19ff9413 100644 --- a/app/graphql/types/task_completion_status.rb +++ b/app/graphql/types/task_completion_status.rb @@ -8,9 +8,9 @@ module Types graphql_name 'TaskCompletionStatus' description 'Completion status of tasks' - field :count, GraphQL::INT_TYPE, null: false, + field :count, GraphQL::Types::Int, null: false, description: 'Number of total tasks.' - field :completed_count, GraphQL::INT_TYPE, null: false, + field :completed_count, GraphQL::Types::Int, null: false, description: 'Number of completed tasks.' end # rubocop: enable Graphql/AuthorizeTypes diff --git a/app/graphql/types/terraform/state_type.rb b/app/graphql/types/terraform/state_type.rb index 9e2c47a9ece..cbd5aeaeef9 100644 --- a/app/graphql/types/terraform/state_type.rb +++ b/app/graphql/types/terraform/state_type.rb @@ -9,11 +9,11 @@ module Types connection_type_class(Types::CountableConnectionType) - field :id, GraphQL::ID_TYPE, + field :id, GraphQL::Types::ID, null: false, description: 'ID of the Terraform state.' - field :name, GraphQL::STRING_TYPE, + field :name, GraphQL::Types::String, null: false, description: 'Name of the Terraform state.' diff --git a/app/graphql/types/terraform/state_version_type.rb b/app/graphql/types/terraform/state_version_type.rb index 2cd2ec8dcda..545b3c0044d 100644 --- a/app/graphql/types/terraform/state_version_type.rb +++ b/app/graphql/types/terraform/state_version_type.rb @@ -9,7 +9,7 @@ module Types authorize :read_terraform_state - field :id, GraphQL::ID_TYPE, + field :id, GraphQL::Types::ID, null: false, description: 'ID of the Terraform state version.' @@ -17,7 +17,7 @@ module Types null: true, description: 'The user that created this version.' - field :download_path, GraphQL::STRING_TYPE, + field :download_path, GraphQL::Types::String, null: true, description: "URL for downloading the version's JSON file." @@ -25,7 +25,7 @@ module Types null: true, description: 'The job that created this version.' - field :serial, GraphQL::INT_TYPE, + field :serial, GraphQL::Types::Int, null: true, description: 'Serial number of the version.', method: :version diff --git a/app/graphql/types/timelog_type.rb b/app/graphql/types/timelog_type.rb index 925a522629e..206aabbada3 100644 --- a/app/graphql/types/timelog_type.rb +++ b/app/graphql/types/timelog_type.rb @@ -12,7 +12,7 @@ module Types description: 'Timestamp of when the time tracked was spent at.' field :time_spent, - GraphQL::INT_TYPE, + GraphQL::Types::Int, null: false, description: 'The time spent displayed in seconds.' @@ -36,6 +36,10 @@ module Types null: true, description: 'The note where the quick action to add the logged time was executed.' + field :summary, GraphQL::Types::String, + null: true, + description: 'The summary of how the time was spent.' + def user Gitlab::Graphql::Loaders::BatchModelLoader.new(User, object.user_id).find end diff --git a/app/graphql/types/todo_type.rb b/app/graphql/types/todo_type.rb index 3b983060de2..24c110ce09b 100644 --- a/app/graphql/types/todo_type.rb +++ b/app/graphql/types/todo_type.rb @@ -9,7 +9,7 @@ module Types authorize :read_todo - field :id, GraphQL::ID_TYPE, + field :id, GraphQL::Types::ID, description: 'ID of the to-do item.', null: false @@ -35,7 +35,7 @@ module Types description: 'Target type of the to-do item.', null: false - field :body, GraphQL::STRING_TYPE, + field :body, GraphQL::Types::String, description: 'Body of the to-do item.', null: false, calls_gitaly: true # TODO This is only true when `target_type` is `Commit`. See https://gitlab.com/gitlab-org/gitlab/issues/34757#note_234752665 diff --git a/app/graphql/types/tree/blob_type.rb b/app/graphql/types/tree/blob_type.rb index d192c8d3c57..bb15d91a62f 100644 --- a/app/graphql/types/tree/blob_type.rb +++ b/app/graphql/types/tree/blob_type.rb @@ -10,14 +10,14 @@ module Types graphql_name 'Blob' - field :web_url, GraphQL::STRING_TYPE, null: true, + field :web_url, GraphQL::Types::String, null: true, description: 'Web URL of the blob.' - field :web_path, GraphQL::STRING_TYPE, null: true, + field :web_path, GraphQL::Types::String, null: true, description: 'Web path of the blob.' - field :lfs_oid, GraphQL::STRING_TYPE, null: true, + field :lfs_oid, GraphQL::Types::String, null: true, calls_gitaly: true, description: 'LFS ID of the blob.' - field :mode, GraphQL::STRING_TYPE, null: true, + field :mode, GraphQL::Types::String, null: true, description: 'Blob mode in numeric format.' def lfs_oid diff --git a/app/graphql/types/tree/entry_type.rb b/app/graphql/types/tree/entry_type.rb index c0150b77c55..1c612f91a5b 100644 --- a/app/graphql/types/tree/entry_type.rb +++ b/app/graphql/types/tree/entry_type.rb @@ -4,17 +4,17 @@ module Types module EntryType include Types::BaseInterface - field :id, GraphQL::ID_TYPE, null: false, + field :id, GraphQL::Types::ID, null: false, description: 'ID of the entry.' - field :sha, GraphQL::STRING_TYPE, null: false, + field :sha, GraphQL::Types::String, null: false, description: 'Last commit SHA for the entry.', method: :id - field :name, GraphQL::STRING_TYPE, null: false, + field :name, GraphQL::Types::String, null: false, description: 'Name of the entry.' field :type, Tree::TypeEnum, null: false, description: 'Type of tree entry.' - field :path, GraphQL::STRING_TYPE, null: false, + field :path, GraphQL::Types::String, null: false, description: 'Path of the entry.' - field :flat_path, GraphQL::STRING_TYPE, null: false, + field :flat_path, GraphQL::Types::String, null: false, description: 'Flat path of the entry.' end end diff --git a/app/graphql/types/tree/submodule_type.rb b/app/graphql/types/tree/submodule_type.rb index 519e866ebb0..05d8c1a951a 100644 --- a/app/graphql/types/tree/submodule_type.rb +++ b/app/graphql/types/tree/submodule_type.rb @@ -8,9 +8,9 @@ module Types graphql_name 'Submodule' - field :web_url, type: GraphQL::STRING_TYPE, null: true, + field :web_url, type: GraphQL::Types::String, null: true, description: 'Web URL for the sub-module.' - field :tree_url, type: GraphQL::STRING_TYPE, null: true, + field :tree_url, type: GraphQL::Types::String, null: true, description: 'Tree URL for the sub-module.' end # rubocop: enable Graphql/AuthorizeTypes diff --git a/app/graphql/types/tree/tree_entry_type.rb b/app/graphql/types/tree/tree_entry_type.rb index daf4b5421fb..998b3617574 100644 --- a/app/graphql/types/tree/tree_entry_type.rb +++ b/app/graphql/types/tree/tree_entry_type.rb @@ -11,9 +11,9 @@ module Types graphql_name 'TreeEntry' description 'Represents a directory' - field :web_url, GraphQL::STRING_TYPE, null: true, + field :web_url, GraphQL::Types::String, null: true, description: 'Web URL for the tree entry (directory).' - field :web_path, GraphQL::STRING_TYPE, null: true, + field :web_path, GraphQL::Types::String, null: true, description: 'Web path for the tree entry (directory).' end # rubocop: enable Graphql/AuthorizeTypes diff --git a/app/graphql/types/user_interface.rb b/app/graphql/types/user_interface.rb index 7d61b296eae..71c6b7f3019 100644 --- a/app/graphql/types/user_interface.rb +++ b/app/graphql/types/user_interface.rb @@ -14,20 +14,20 @@ module Types method: :itself field :id, - type: GraphQL::ID_TYPE, + type: GraphQL::Types::ID, null: false, description: 'ID of the user.' field :bot, - type: GraphQL::BOOLEAN_TYPE, + type: GraphQL::Types::Boolean, null: false, description: 'Indicates if the user is a bot.', method: :bot? field :username, - type: GraphQL::STRING_TYPE, + type: GraphQL::Types::String, null: false, description: 'Username of the user. Unique within this instance of GitLab.' field :name, - type: GraphQL::STRING_TYPE, + type: GraphQL::Types::String, null: false, description: 'Human-readable name of the user.' field :state, @@ -35,24 +35,24 @@ module Types null: false, description: 'State of the user.' field :email, - type: GraphQL::STRING_TYPE, + type: GraphQL::Types::String, null: true, description: 'User email.', method: :public_email, deprecated: { reason: :renamed, replacement: 'User.publicEmail', milestone: '13.7' } field :public_email, - type: GraphQL::STRING_TYPE, + type: GraphQL::Types::String, null: true, description: "User's public email." field :avatar_url, - type: GraphQL::STRING_TYPE, + type: GraphQL::Types::String, null: true, description: "URL of the user's avatar." field :web_url, - type: GraphQL::STRING_TYPE, + type: GraphQL::Types::String, null: false, description: 'Web URL of the user.' field :web_path, - type: GraphQL::STRING_TYPE, + type: GraphQL::Types::String, null: false, description: 'Web path of the user.' field :group_memberships, @@ -67,7 +67,7 @@ module Types null: true, description: 'User status.' field :location, - type: ::GraphQL::STRING_TYPE, + type: ::GraphQL::Types::String, null: true, description: 'The location of the user.' field :project_memberships, @@ -77,6 +77,10 @@ module Types field :starred_projects, description: 'Projects starred by the user.', resolver: Resolvers::UserStarredProjectsResolver + field :namespace, + type: Types::NamespaceType, + null: true, + description: 'Personal namespace of the user.' field :todos, resolver: Resolvers::TodoResolver, description: 'To-do items of the user.' do extension(::Gitlab::Graphql::TodosProjectPermissionPreloader::FieldExtension) @@ -100,6 +104,13 @@ module Types Types::UserCalloutType.connection_type, null: true, description: 'User callouts that belong to the user.' + field :timelogs, + Types::TimelogType.connection_type, + null: true, + description: 'Time logged by the user.', + extras: [:lookahead], + complexity: 5, + resolver: ::Resolvers::TimelogResolver definition_methods do def resolve_type(object, context) diff --git a/app/graphql/types/user_merge_request_interaction_type.rb b/app/graphql/types/user_merge_request_interaction_type.rb index b9ff489e0d6..ff6e83efbb2 100644 --- a/app/graphql/types/user_merge_request_interaction_type.rb +++ b/app/graphql/types/user_merge_request_interaction_type.rb @@ -13,14 +13,14 @@ module Types authorize :read_merge_request field :can_merge, - type: ::GraphQL::BOOLEAN_TYPE, + type: ::GraphQL::Types::Boolean, null: false, calls_gitaly: true, method: :can_merge?, description: 'Whether this user can merge this merge request.' field :can_update, - type: ::GraphQL::BOOLEAN_TYPE, + type: ::GraphQL::Types::Boolean, null: false, method: :can_update?, description: 'Whether this user can update this merge request.' @@ -31,13 +31,13 @@ module Types description: 'The state of the review by this user.' field :reviewed, - type: ::GraphQL::BOOLEAN_TYPE, + type: ::GraphQL::Types::Boolean, null: false, method: :reviewed?, description: 'Whether this user has provided a review for this merge request.' field :approved, - type: ::GraphQL::BOOLEAN_TYPE, + type: ::GraphQL::Types::Boolean, null: false, method: :approved?, description: 'Whether this user has approved this merge request.' diff --git a/app/graphql/types/user_status_type.rb b/app/graphql/types/user_status_type.rb index c1a736a3722..61abec0ba96 100644 --- a/app/graphql/types/user_status_type.rb +++ b/app/graphql/types/user_status_type.rb @@ -7,9 +7,9 @@ module Types markdown_field :message_html, null: true, description: 'HTML of the user status message' - field :message, GraphQL::STRING_TYPE, null: true, + field :message, GraphQL::Types::String, null: true, description: 'User status message.' - field :emoji, GraphQL::STRING_TYPE, null: true, + field :emoji, GraphQL::Types::String, null: true, description: 'String representation of emoji.' field :availability, Types::AvailabilityEnum, null: false, description: 'User availability status.' |