Commit 156388ac authored by Alex Kalderimis's avatar Alex Kalderimis

Add correct types and descriptions

This fixes some errors and omissions in our schema.

- Correct type nullability for snippets resolvers
- Specify correct type for user starred projects resolver
- Add description to User type

Fixes a test failure due to change of resolver type (the resolver
now, correctly, returns a connection, which needs different handling).
parent 0081e0d0
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
module Resolvers module Resolvers
module Ci module Ci
class RunnerPlatformsResolver < BaseResolver class RunnerPlatformsResolver < BaseResolver
type Types::Ci::RunnerPlatformType, null: false type Types::Ci::RunnerPlatformType.connection_type, null: true
description 'Supported runner platforms.'
def resolve(**args) def resolve(**args)
runner_instructions.map do |platform, data| runner_instructions.map do |platform, data|
......
...@@ -4,6 +4,7 @@ module Resolvers ...@@ -4,6 +4,7 @@ module Resolvers
module Ci module Ci
class RunnerSetupResolver < BaseResolver class RunnerSetupResolver < BaseResolver
type Types::Ci::RunnerSetupType, null: true type Types::Ci::RunnerSetupType, null: true
description 'Runner setup instructions.'
argument :platform, GraphQL::STRING_TYPE, argument :platform, GraphQL::STRING_TYPE,
required: true, required: true,
......
...@@ -4,7 +4,7 @@ module ResolvesSnippets ...@@ -4,7 +4,7 @@ module ResolvesSnippets
extend ActiveSupport::Concern extend ActiveSupport::Concern
included do included do
type Types::SnippetType.connection_type, null: false type Types::SnippetType.connection_type, null: true
argument :ids, [::Types::GlobalIDType[::Snippet]], argument :ids, [::Types::GlobalIDType[::Snippet]],
required: false, required: false,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module Resolvers module Resolvers
class UserStarredProjectsResolver < BaseResolver class UserStarredProjectsResolver < BaseResolver
type Types::ProjectType, null: true type Types::ProjectType.connection_type, null: true
argument :search, GraphQL::STRING_TYPE, argument :search, GraphQL::STRING_TYPE,
required: false, required: false,
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
module Types module Types
class UserType < BaseObject class UserType < BaseObject
graphql_name 'User' graphql_name 'User'
description 'Representation of a GitLab user.'
authorize :read_user authorize :read_user
......
...@@ -9,7 +9,7 @@ RSpec.describe Resolvers::Ci::RunnerPlatformsResolver do ...@@ -9,7 +9,7 @@ RSpec.describe Resolvers::Ci::RunnerPlatformsResolver do
subject(:resolve_subject) { resolve(described_class) } subject(:resolve_subject) { resolve(described_class) }
it 'returns all possible runner platforms' do it 'returns all possible runner platforms' do
expect(resolve_subject).to include( expect(resolve_subject).to contain_exactly(
hash_including(name: :linux), hash_including(name: :osx), hash_including(name: :linux), hash_including(name: :osx),
hash_including(name: :windows), hash_including(name: :docker), hash_including(name: :windows), hash_including(name: :docker),
hash_including(name: :kubernetes) hash_including(name: :kubernetes)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment