Commit b6216e88 authored by Michael Kozono's avatar Michael Kozono

Merge branch '336292-convert-old-graphql-types-to-newer-type-names-10' into 'master'

Convert old GraphQL types to newer type names (Part 10) [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!66979
parents 6e9ec35e 760218e4
...@@ -446,9 +446,10 @@ Graphql/OldTypes: ...@@ -446,9 +446,10 @@ Graphql/OldTypes:
Include: Include:
- 'app/graphql/**/*' - 'app/graphql/**/*'
- 'ee/app/graphql/**/*' - 'ee/app/graphql/**/*'
Exclude: - 'spec/graphql/**/*'
- 'spec/**/*.rb' - 'spec/requests/api/graphql/**/*'
- 'ee/spec/**/*.rb' - 'ee/spec/graphql/**/*'
- 'ee/spec/requests/api/graphql/**/*'
RSpec/EnvAssignment: RSpec/EnvAssignment:
Enable: true Enable: true
......
...@@ -23,23 +23,6 @@ Graphql/Descriptions: ...@@ -23,23 +23,6 @@ Graphql/Descriptions:
- 'ee/app/graphql/types/vulnerability_severity_enum.rb' - 'ee/app/graphql/types/vulnerability_severity_enum.rb'
- 'ee/app/graphql/types/vulnerability_state_enum.rb' - 'ee/app/graphql/types/vulnerability_state_enum.rb'
# WIP See https://gitlab.com/gitlab-org/gitlab/-/issues/336292
Graphql/OldTypes:
Exclude:
- 'spec/**/*.rb'
- 'ee/spec/**/*.rb'
- 'ee/app/graphql/ee/mutations/ci/ci_cd_settings_update.rb'
- 'ee/app/graphql/ee/resolvers/issues_resolver.rb'
- 'ee/app/graphql/ee/resolvers/namespace_projects_resolver.rb'
- 'ee/app/graphql/ee/types/board_list_type.rb'
- 'ee/app/graphql/ee/types/boards/board_issue_input_base_type.rb'
- 'ee/app/graphql/ee/types/issue_connection_type.rb'
- 'ee/app/graphql/ee/types/issue_type.rb'
- 'ee/app/graphql/ee/types/issues/negated_issue_filter_input_type.rb'
- 'ee/app/graphql/ee/types/merge_request_type.rb'
- 'ee/app/graphql/ee/types/namespace_type.rb'
- 'ee/app/graphql/ee/types/project_type.rb'
# WIP: See https://gitlab.com/gitlab-org/gitlab/-/issues/220040 # WIP: See https://gitlab.com/gitlab-org/gitlab/-/issues/220040
Rails/SaveBang: Rails/SaveBang:
Exclude: Exclude:
......
...@@ -82,7 +82,7 @@ module Types ...@@ -82,7 +82,7 @@ module Types
snippets: 'Snippets are', snippets: 'Snippets are',
container_registry: 'Container Registry is' container_registry: 'Container Registry is'
}.each do |feature, name_string| }.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" description: "Indicates if #{name_string} enabled for the current user"
define_method "#{feature}_enabled" do define_method "#{feature}_enabled" do
......
...@@ -105,7 +105,7 @@ RSpec.describe 'DeclarativePolicy authorization in GraphQL ' do ...@@ -105,7 +105,7 @@ RSpec.describe 'DeclarativePolicy authorization in GraphQL ' do
describe 'with a single permission' do describe 'with a single permission' do
let(:type) do let(:type) do
type_factory do |type| type_factory do |type|
type.field :name, GraphQL::STRING_TYPE, null: true, authorize: permission_single type.field :name, GraphQL::Types::String, null: true, authorize: permission_single
end end
end end
...@@ -124,7 +124,7 @@ RSpec.describe 'DeclarativePolicy authorization in GraphQL ' do ...@@ -124,7 +124,7 @@ RSpec.describe 'DeclarativePolicy authorization in GraphQL ' do
let(:type) do let(:type) do
permissions = permission_collection permissions = permission_collection
type_factory do |type| type_factory do |type|
type.field :name, GraphQL::STRING_TYPE, type.field :name, GraphQL::Types::String,
null: true, null: true,
authorize: permissions authorize: permissions
end end
...@@ -332,7 +332,7 @@ RSpec.describe 'DeclarativePolicy authorization in GraphQL ' do ...@@ -332,7 +332,7 @@ RSpec.describe 'DeclarativePolicy authorization in GraphQL ' do
type_factory do |type| type_factory do |type|
type.graphql_name 'FakeIssueType' type.graphql_name 'FakeIssueType'
type.authorize :read_issue type.authorize :read_issue
type.field :id, GraphQL::ID_TYPE, null: false type.field :id, GraphQL::Types::ID, null: false
end end
end end
......
...@@ -15,7 +15,7 @@ RSpec.describe ::Mutations::BaseMutation do ...@@ -15,7 +15,7 @@ RSpec.describe ::Mutations::BaseMutation do
context 'when argument is nullable and required' do context 'when argument is nullable and required' do
let(:mutation_class) do let(:mutation_class) do
Class.new(described_class) do Class.new(described_class) do
argument :foo, GraphQL::STRING_TYPE, required: :nullable argument :foo, GraphQL::Types::String, required: :nullable
end end
end end
...@@ -35,7 +35,7 @@ RSpec.describe ::Mutations::BaseMutation do ...@@ -35,7 +35,7 @@ RSpec.describe ::Mutations::BaseMutation do
context 'when argument is required and NOT nullable' do context 'when argument is required and NOT nullable' do
let(:mutation_class) do let(:mutation_class) do
Class.new(described_class) do Class.new(described_class) do
argument :foo, GraphQL::STRING_TYPE, required: true argument :foo, GraphQL::Types::String, required: true
end end
end end
......
...@@ -40,7 +40,7 @@ RSpec.describe Subscriptions::IssuableUpdated do ...@@ -40,7 +40,7 @@ RSpec.describe Subscriptions::IssuableUpdated do
end end
end end
context 'when a GraphQL::ID_TYPE is provided' do context 'when a GraphQL::Types::ID is provided' do
let(:issuable_id) { issue.to_gid.to_s } let(:issuable_id) { issue.to_gid.to_s }
it 'raises an exception' do it 'raises an exception' do
......
...@@ -7,7 +7,7 @@ RSpec.describe Gitlab::Graphql::CallsGitaly::FieldExtension, :request_store do ...@@ -7,7 +7,7 @@ RSpec.describe Gitlab::Graphql::CallsGitaly::FieldExtension, :request_store do
let(:field_args) { {} } let(:field_args) { {} }
let(:owner) { fresh_object_type } let(:owner) { fresh_object_type }
let(:field) do let(:field) do
::Types::BaseField.new(name: 'value', type: GraphQL::STRING_TYPE, null: true, owner: owner, **field_args) ::Types::BaseField.new(name: 'value', type: GraphQL::Types::String, null: true, owner: owner, **field_args)
end end
def resolve_value def resolve_value
......
...@@ -10,7 +10,7 @@ RSpec.describe Gitlab::Graphql::CopyFieldDescription do ...@@ -10,7 +10,7 @@ RSpec.describe Gitlab::Graphql::CopyFieldDescription do
Class.new(Types::BaseObject) do Class.new(Types::BaseObject) do
graphql_name "TestType" graphql_name "TestType"
field :field_name, GraphQL::STRING_TYPE, null: true, description: 'Foo' field :field_name, GraphQL::Types::String, null: true, description: 'Foo'
end end
end end
......
...@@ -6,8 +6,8 @@ RSpec.describe Gitlab::Graphql::MountMutation do ...@@ -6,8 +6,8 @@ RSpec.describe Gitlab::Graphql::MountMutation do
Class.new(Mutations::BaseMutation) do Class.new(Mutations::BaseMutation) do
graphql_name 'TestMutation' graphql_name 'TestMutation'
argument :foo, GraphQL::STRING_TYPE, required: false argument :foo, GraphQL::Types::String, required: false
field :bar, GraphQL::STRING_TYPE, null: true field :bar, GraphQL::Types::String, null: true
end end
end end
......
...@@ -19,7 +19,7 @@ RSpec.describe Gitlab::Graphql::NegatableArguments do ...@@ -19,7 +19,7 @@ RSpec.describe Gitlab::Graphql::NegatableArguments do
it 'defines any arguments passed as block' do it 'defines any arguments passed as block' do
test_resolver.negated do test_resolver.negated do
argument :foo, GraphQL::STRING_TYPE, required: false argument :foo, GraphQL::Types::String, required: false
end end
expect(test_resolver.arguments['not'].type.arguments.keys).to match_array(['foo']) expect(test_resolver.arguments['not'].type.arguments.keys).to match_array(['foo'])
...@@ -27,10 +27,10 @@ RSpec.describe Gitlab::Graphql::NegatableArguments do ...@@ -27,10 +27,10 @@ RSpec.describe Gitlab::Graphql::NegatableArguments do
it 'defines all arguments passed as block even if called multiple times' do it 'defines all arguments passed as block even if called multiple times' do
test_resolver.negated do test_resolver.negated do
argument :foo, GraphQL::STRING_TYPE, required: false argument :foo, GraphQL::Types::String, required: false
end end
test_resolver.negated do test_resolver.negated do
argument :bar, GraphQL::STRING_TYPE, required: false argument :bar, GraphQL::Types::String, required: false
end end
expect(test_resolver.arguments['not'].type.arguments.keys).to match_array(%w[foo bar]) expect(test_resolver.arguments['not'].type.arguments.keys).to match_array(%w[foo bar])
......
...@@ -33,7 +33,7 @@ RSpec.describe ::Gitlab::Graphql::Pagination::Connections do ...@@ -33,7 +33,7 @@ RSpec.describe ::Gitlab::Graphql::Pagination::Connections do
let(:node_type) do let(:node_type) do
Class.new(::GraphQL::Schema::Object) do Class.new(::GraphQL::Schema::Object) do
graphql_name 'Node' graphql_name 'Node'
field :value, GraphQL::INT_TYPE, null: false field :value, GraphQL::Types::Int, null: false
end end
end end
......
...@@ -10,7 +10,7 @@ RSpec.describe Gitlab::Graphql::Present::FieldExtension do ...@@ -10,7 +10,7 @@ RSpec.describe Gitlab::Graphql::Present::FieldExtension do
let(:owner) { fresh_object_type } let(:owner) { fresh_object_type }
let(:field_name) { 'value' } let(:field_name) { 'value' }
let(:field) do let(:field) do
::Types::BaseField.new(name: field_name, type: GraphQL::STRING_TYPE, null: true, owner: owner) ::Types::BaseField.new(name: field_name, type: GraphQL::Types::String, null: true, owner: owner)
end end
let(:base_presenter) do let(:base_presenter) do
...@@ -38,7 +38,7 @@ RSpec.describe Gitlab::Graphql::Present::FieldExtension do ...@@ -38,7 +38,7 @@ RSpec.describe Gitlab::Graphql::Present::FieldExtension do
Module.new do Module.new do
include ::Types::BaseInterface include ::Types::BaseInterface
field :interface_field, GraphQL::STRING_TYPE, null: true field :interface_field, GraphQL::Types::String, null: true
end end
end end
...@@ -58,7 +58,7 @@ RSpec.describe Gitlab::Graphql::Present::FieldExtension do ...@@ -58,7 +58,7 @@ RSpec.describe Gitlab::Graphql::Present::FieldExtension do
end end
it 'resolves the interface field using the implementation from the presenter' do it 'resolves the interface field using the implementation from the presenter' do
field = ::Types::BaseField.new(name: :interface_field, type: GraphQL::STRING_TYPE, null: true, owner: interface) field = ::Types::BaseField.new(name: :interface_field, type: GraphQL::Types::String, null: true, owner: interface)
value = resolve_field(field, object, object_type: implementation) value = resolve_field(field, object, object_type: implementation)
expect(value).to eq 'made of concrete' expect(value).to eq 'made of concrete'
...@@ -67,7 +67,7 @@ RSpec.describe Gitlab::Graphql::Present::FieldExtension do ...@@ -67,7 +67,7 @@ RSpec.describe Gitlab::Graphql::Present::FieldExtension do
context 'when the implementation is inherited' do context 'when the implementation is inherited' do
it 'resolves the interface field using the implementation from the presenter' do it 'resolves the interface field using the implementation from the presenter' do
subclass = Class.new(implementation) { graphql_name 'Subclass' } subclass = Class.new(implementation) { graphql_name 'Subclass' }
field = ::Types::BaseField.new(name: :interface_field, type: GraphQL::STRING_TYPE, null: true, owner: interface) field = ::Types::BaseField.new(name: :interface_field, type: GraphQL::Types::String, null: true, owner: interface)
value = resolve_field(field, object, object_type: subclass) value = resolve_field(field, object, object_type: subclass)
expect(value).to eq 'made of concrete' expect(value).to eq 'made of concrete'
...@@ -79,8 +79,8 @@ RSpec.describe Gitlab::Graphql::Present::FieldExtension do ...@@ -79,8 +79,8 @@ RSpec.describe Gitlab::Graphql::Present::FieldExtension do
def parent def parent
type = fresh_object_type('Parent') type = fresh_object_type('Parent')
type.present_using(provide_foo) type.present_using(provide_foo)
type.field :foo, ::GraphQL::INT_TYPE, null: true type.field :foo, ::GraphQL::Types::Int, null: true
type.field :value, ::GraphQL::STRING_TYPE, null: true type.field :value, ::GraphQL::Types::String, null: true
type type
end end
...@@ -88,7 +88,7 @@ RSpec.describe Gitlab::Graphql::Present::FieldExtension do ...@@ -88,7 +88,7 @@ RSpec.describe Gitlab::Graphql::Present::FieldExtension do
type = Class.new(parent) type = Class.new(parent)
type.graphql_name 'Child' type.graphql_name 'Child'
type.present_using(provide_bar) type.present_using(provide_bar)
type.field :bar, ::GraphQL::INT_TYPE, null: true type.field :bar, ::GraphQL::Types::Int, null: true
type type
end end
...@@ -150,7 +150,7 @@ RSpec.describe Gitlab::Graphql::Present::FieldExtension do ...@@ -150,7 +150,7 @@ RSpec.describe Gitlab::Graphql::Present::FieldExtension do
let(:field) do let(:field) do
::Types::BaseField.new( ::Types::BaseField.new(
name: field_name, name: field_name,
type: GraphQL::STRING_TYPE, type: GraphQL::Types::String,
null: true, null: true,
owner: owner, owner: owner,
resolve: ->(obj, args, ctx) { 'Hello from a proc' } resolve: ->(obj, args, ctx) { 'Hello from a proc' }
......
...@@ -21,30 +21,30 @@ RSpec.describe Gitlab::Graphql::Queries do ...@@ -21,30 +21,30 @@ RSpec.describe Gitlab::Graphql::Queries do
let_it_be(:schema) do let_it_be(:schema) do
author = Class.new(GraphQL::Schema::Object) do author = Class.new(GraphQL::Schema::Object) do
graphql_name 'Author' graphql_name 'Author'
field :name, GraphQL::STRING_TYPE, null: true field :name, GraphQL::Types::String, null: true
field :handle, GraphQL::STRING_TYPE, null: false field :handle, GraphQL::Types::String, null: false
field :verified, GraphQL::BOOLEAN_TYPE, null: false field :verified, GraphQL::Types::Boolean, null: false
end end
post = Class.new(GraphQL::Schema::Object) do post = Class.new(GraphQL::Schema::Object) do
graphql_name 'Post' graphql_name 'Post'
field :name, GraphQL::STRING_TYPE, null: false field :name, GraphQL::Types::String, null: false
field :title, GraphQL::STRING_TYPE, null: false field :title, GraphQL::Types::String, null: false
field :content, GraphQL::STRING_TYPE, null: true field :content, GraphQL::Types::String, null: true
field :author, author, null: false field :author, author, null: false
end end
author.field :posts, [post], null: false do author.field :posts, [post], null: false do
argument :blog_title, GraphQL::STRING_TYPE, required: false argument :blog_title, GraphQL::Types::String, required: false
end end
blog = Class.new(GraphQL::Schema::Object) do blog = Class.new(GraphQL::Schema::Object) do
graphql_name 'Blog' graphql_name 'Blog'
field :title, GraphQL::STRING_TYPE, null: false field :title, GraphQL::Types::String, null: false
field :description, GraphQL::STRING_TYPE, null: false field :description, GraphQL::Types::String, null: false
field :main_author, author, null: false field :main_author, author, null: false
field :posts, [post], null: false field :posts, [post], null: false
field :post, post, null: true do field :post, post, null: true do
argument :slug, GraphQL::STRING_TYPE, required: true argument :slug, GraphQL::Types::String, required: true
end end
end end
...@@ -52,10 +52,10 @@ RSpec.describe Gitlab::Graphql::Queries do ...@@ -52,10 +52,10 @@ RSpec.describe Gitlab::Graphql::Queries do
query(Class.new(GraphQL::Schema::Object) do query(Class.new(GraphQL::Schema::Object) do
graphql_name 'Query' graphql_name 'Query'
field :blog, blog, null: true do field :blog, blog, null: true do
argument :title, GraphQL::STRING_TYPE, required: true argument :title, GraphQL::Types::String, required: true
end end
field :post, post, null: true do field :post, post, null: true do
argument :slug, GraphQL::STRING_TYPE, required: true argument :slug, GraphQL::Types::String, required: true
end end
end) end)
end end
......
...@@ -222,7 +222,7 @@ RSpec.describe RuboCop::Cop::Gitlab::MarkUsedFeatureFlags do ...@@ -222,7 +222,7 @@ RSpec.describe RuboCop::Cop::Gitlab::MarkUsedFeatureFlags do
include_examples 'does not set any flags as used', 'field :solution' include_examples 'does not set any flags as used', 'field :solution'
include_examples 'does not set any flags as used', 'field :runners, Types::Ci::RunnerType.connection_type' include_examples 'does not set any flags as used', 'field :runners, Types::Ci::RunnerType.connection_type'
include_examples 'does not set any flags as used', 'field :runners, Types::Ci::RunnerType.connection_type, null: true, description: "hello world"' include_examples 'does not set any flags as used', 'field :runners, Types::Ci::RunnerType.connection_type, null: true, description: "hello world"'
include_examples 'does not set any flags as used', 'field :solution, type: GraphQL::STRING_TYPE, null: true, description: "URL to the vulnerabilitys details page."' include_examples 'does not set any flags as used', 'field :solution, type: GraphQL::Types::String, null: true, description: "URL to the vulnerabilitys details page."'
end end
describe "tracking of usage data metrics known events happens at the beginning of inspection" do describe "tracking of usage data metrics known events happens at the beginning of inspection" do
......
...@@ -13,7 +13,7 @@ RSpec.describe RuboCop::Cop::Graphql::Descriptions do ...@@ -13,7 +13,7 @@ RSpec.describe RuboCop::Cop::Graphql::Descriptions do
class FakeType < BaseObject class FakeType < BaseObject
field :a_thing, field :a_thing,
^^^^^^^^^^^^^^^ Please add a `description` property. ^^^^^^^^^^^^^^^ Please add a `description` property.
GraphQL::STRING_TYPE, GraphQL::Types::String,
null: false null: false
end end
end end
...@@ -26,7 +26,7 @@ RSpec.describe RuboCop::Cop::Graphql::Descriptions do ...@@ -26,7 +26,7 @@ RSpec.describe RuboCop::Cop::Graphql::Descriptions do
class FakeType < BaseObject class FakeType < BaseObject
field :a_thing, field :a_thing,
^^^^^^^^^^^^^^^ `description` strings must end with a `.`. ^^^^^^^^^^^^^^^ `description` strings must end with a `.`.
GraphQL::STRING_TYPE, GraphQL::Types::String,
null: false, null: false,
description: 'A descriptive description' description: 'A descriptive description'
end end
...@@ -39,7 +39,7 @@ RSpec.describe RuboCop::Cop::Graphql::Descriptions do ...@@ -39,7 +39,7 @@ RSpec.describe RuboCop::Cop::Graphql::Descriptions do
module Types module Types
class FakeType < BaseObject class FakeType < BaseObject
field :a_thing, field :a_thing,
GraphQL::STRING_TYPE, GraphQL::Types::String,
null: false, null: false,
description: 'A descriptive description.' description: 'A descriptive description.'
end end
...@@ -65,7 +65,7 @@ RSpec.describe RuboCop::Cop::Graphql::Descriptions do ...@@ -65,7 +65,7 @@ RSpec.describe RuboCop::Cop::Graphql::Descriptions do
class FakeType < BaseObject class FakeType < BaseObject
argument :a_thing, argument :a_thing,
^^^^^^^^^^^^^^^^^^ Please add a `description` property. ^^^^^^^^^^^^^^^^^^ Please add a `description` property.
GraphQL::STRING_TYPE, GraphQL::Types::String,
null: false null: false
end end
end end
...@@ -78,7 +78,7 @@ RSpec.describe RuboCop::Cop::Graphql::Descriptions do ...@@ -78,7 +78,7 @@ RSpec.describe RuboCop::Cop::Graphql::Descriptions do
class FakeType < BaseObject class FakeType < BaseObject
argument :a_thing, argument :a_thing,
^^^^^^^^^^^^^^^^^^ `description` strings must end with a `.`. ^^^^^^^^^^^^^^^^^^ `description` strings must end with a `.`.
GraphQL::STRING_TYPE, GraphQL::Types::String,
null: false, null: false,
description: 'Behold! A description' description: 'Behold! A description'
end end
...@@ -91,7 +91,7 @@ RSpec.describe RuboCop::Cop::Graphql::Descriptions do ...@@ -91,7 +91,7 @@ RSpec.describe RuboCop::Cop::Graphql::Descriptions do
module Types module Types
class FakeType < BaseObject class FakeType < BaseObject
argument :a_thing, argument :a_thing,
GraphQL::STRING_TYPE, GraphQL::Types::String,
null: false, null: false,
description: 'Behold! A description.' description: 'Behold! A description.'
end end
...@@ -151,7 +151,7 @@ RSpec.describe RuboCop::Cop::Graphql::Descriptions do ...@@ -151,7 +151,7 @@ RSpec.describe RuboCop::Cop::Graphql::Descriptions do
class FakeType < BaseObject class FakeType < BaseObject
field :a_thing, field :a_thing,
^^^^^^^^^^^^^^^ `description` strings must end with a `.`. ^^^^^^^^^^^^^^^ `description` strings must end with a `.`.
GraphQL::STRING_TYPE, GraphQL::Types::String,
null: false, null: false,
description: 'Behold! A description' description: 'Behold! A description'
end end
...@@ -162,7 +162,7 @@ RSpec.describe RuboCop::Cop::Graphql::Descriptions do ...@@ -162,7 +162,7 @@ RSpec.describe RuboCop::Cop::Graphql::Descriptions do
module Types module Types
class FakeType < BaseObject class FakeType < BaseObject
field :a_thing, field :a_thing,
GraphQL::STRING_TYPE, GraphQL::Types::String,
null: false, null: false,
description: 'Behold! A description.' description: 'Behold! A description.'
end end
...@@ -176,7 +176,7 @@ RSpec.describe RuboCop::Cop::Graphql::Descriptions do ...@@ -176,7 +176,7 @@ RSpec.describe RuboCop::Cop::Graphql::Descriptions do
class FakeType < BaseObject class FakeType < BaseObject
field :a_thing, field :a_thing,
^^^^^^^^^^^^^^^ `description` strings must end with a `.`. ^^^^^^^^^^^^^^^ `description` strings must end with a `.`.
GraphQL::STRING_TYPE, GraphQL::Types::String,
null: false, null: false,
description: <<~DESC description: <<~DESC
Behold! A description Behold! A description
...@@ -189,7 +189,7 @@ RSpec.describe RuboCop::Cop::Graphql::Descriptions do ...@@ -189,7 +189,7 @@ RSpec.describe RuboCop::Cop::Graphql::Descriptions do
module Types module Types
class FakeType < BaseObject class FakeType < BaseObject
field :a_thing, field :a_thing,
GraphQL::STRING_TYPE, GraphQL::Types::String,
null: false, null: false,
description: <<~DESC description: <<~DESC
Behold! A description. Behold! A description.
......
...@@ -24,7 +24,7 @@ RSpec.describe RuboCop::Cop::Graphql::IDType do ...@@ -24,7 +24,7 @@ RSpec.describe RuboCop::Cop::Graphql::IDType do
end end
end end
it 'does not add an offense for calls to #argument without GraphQL::ID_TYPE' do it 'does not add an offense for calls to #argument without GraphQL::Types::ID' do
expect_no_offenses(<<~TYPE.strip) expect_no_offenses(<<~TYPE.strip)
argument :some_arg, ::Types::GlobalIDType[::Awardable], some: other, params: do_not_matter argument :some_arg, ::Types::GlobalIDType[::Awardable], some: other, params: do_not_matter
TYPE TYPE
......
...@@ -32,7 +32,7 @@ RSpec.describe RuboCop::Cop::Graphql::JSONType do ...@@ -32,7 +32,7 @@ RSpec.describe RuboCop::Cop::Graphql::JSONType do
it 'does not add an offense for other types' do it 'does not add an offense for other types' do
expect_no_offenses(<<~RUBY.strip) expect_no_offenses(<<~RUBY.strip)
class MyType class MyType
field :some_field, GraphQL::STRING_TYPE field :some_field, GraphQL::Types::String
end end
RUBY RUBY
end end
...@@ -60,7 +60,7 @@ RSpec.describe RuboCop::Cop::Graphql::JSONType do ...@@ -60,7 +60,7 @@ RSpec.describe RuboCop::Cop::Graphql::JSONType do
it 'does not add an offense for other types' do it 'does not add an offense for other types' do
expect_no_offenses(<<~RUBY.strip) expect_no_offenses(<<~RUBY.strip)
class MyType class MyType
argument :some_arg, GraphQL::STRING_TYPE argument :some_arg, GraphQL::Types::String
end end
RUBY RUBY
end end
......
...@@ -654,7 +654,7 @@ module GraphqlHelpers ...@@ -654,7 +654,7 @@ module GraphqlHelpers
Class.new(Types::BaseObject) do Class.new(Types::BaseObject) do
graphql_name 'TestType' graphql_name 'TestType'
field :name, GraphQL::STRING_TYPE, null: true field :name, GraphQL::Types::String, null: true
yield(self) if block_given? yield(self) if block_given?
end end
......
...@@ -14,13 +14,13 @@ RSpec.describe Tooling::Graphql::Docs::Renderer do ...@@ -14,13 +14,13 @@ RSpec.describe Tooling::Graphql::Docs::Renderer do
let(:template) { Rails.root.join('tooling/graphql/docs/templates/default.md.haml') } let(:template) { Rails.root.join('tooling/graphql/docs/templates/default.md.haml') }
let(:field_description) { 'List of objects.' } let(:field_description) { 'List of objects.' }
let(:type) { ::GraphQL::INT_TYPE } let(:type) { ::GraphQL::Types::Int }
let(:query_type) do let(:query_type) do
Class.new(Types::BaseObject) { graphql_name 'Query' }.tap do |t| Class.new(Types::BaseObject) { graphql_name 'Query' }.tap do |t|
# this keeps type and field_description in scope. # this keeps type and field_description in scope.
t.field :foo, type, null: true, description: field_description do t.field :foo, type, null: true, description: field_description do
argument :id, GraphQL::ID_TYPE, required: false, description: 'ID of the object.' argument :id, GraphQL::Types::ID, required: false, description: 'ID of the object.'
end end
end end
end end
...@@ -73,7 +73,7 @@ RSpec.describe Tooling::Graphql::Docs::Renderer do ...@@ -73,7 +73,7 @@ RSpec.describe Tooling::Graphql::Docs::Renderer do
Class.new(Types::BaseObject) do Class.new(Types::BaseObject) do
graphql_name 'ArrayTest' graphql_name 'ArrayTest'
field :foo, [GraphQL::STRING_TYPE], null: false, description: 'A description.' field :foo, [GraphQL::Types::String], null: false, description: 'A description.'
end end
end end
...@@ -129,8 +129,8 @@ RSpec.describe Tooling::Graphql::Docs::Renderer do ...@@ -129,8 +129,8 @@ RSpec.describe Tooling::Graphql::Docs::Renderer do
Class.new(Types::BaseObject) do Class.new(Types::BaseObject) do
graphql_name 'OrderingTest' graphql_name 'OrderingTest'
field :foo, GraphQL::STRING_TYPE, null: false, description: 'A description of foo field.' field :foo, GraphQL::Types::String, null: false, description: 'A description of foo field.'
field :bar, GraphQL::STRING_TYPE, null: false, description: 'A description of bar field.' field :bar, GraphQL::Types::String, null: false, description: 'A description of bar field.'
end end
end end
...@@ -154,7 +154,7 @@ RSpec.describe Tooling::Graphql::Docs::Renderer do ...@@ -154,7 +154,7 @@ RSpec.describe Tooling::Graphql::Docs::Renderer do
let(:type) do let(:type) do
wibble = Class.new(::Types::BaseObject) do wibble = Class.new(::Types::BaseObject) do
graphql_name 'Wibble' graphql_name 'Wibble'
field :x, ::GraphQL::INT_TYPE, null: false field :x, ::GraphQL::Types::Int, null: false
end end
Class.new(Types::BaseObject) do Class.new(Types::BaseObject) do
...@@ -162,16 +162,16 @@ RSpec.describe Tooling::Graphql::Docs::Renderer do ...@@ -162,16 +162,16 @@ RSpec.describe Tooling::Graphql::Docs::Renderer do
description 'Testing doc refs' description 'Testing doc refs'
field :foo, field :foo,
type: GraphQL::STRING_TYPE, type: GraphQL::Types::String,
null: false, null: false,
description: 'The foo.', description: 'The foo.',
see: { 'A list of foos' => 'https://example.com/foos' } see: { 'A list of foos' => 'https://example.com/foos' }
field :bar, field :bar,
type: GraphQL::STRING_TYPE, type: GraphQL::Types::String,
null: false, null: false,
description: 'The bar.', description: 'The bar.',
see: { 'A list of bars' => 'https://example.com/bars' } do see: { 'A list of bars' => 'https://example.com/bars' } do
argument :barity, ::GraphQL::INT_TYPE, required: false, description: '?' argument :barity, ::GraphQL::Types::Int, required: false, description: '?'
end end
field :wibbles, field :wibbles,
type: wibble.connection_type, type: wibble.connection_type,
...@@ -220,10 +220,10 @@ RSpec.describe Tooling::Graphql::Docs::Renderer do ...@@ -220,10 +220,10 @@ RSpec.describe Tooling::Graphql::Docs::Renderer do
description 'A thing we used to use, but no longer support' description 'A thing we used to use, but no longer support'
field :foo, field :foo,
type: GraphQL::STRING_TYPE, type: GraphQL::Types::String,
null: false, null: false,
description: 'A description.' do description: 'A description.' do
argument :foo_arg, GraphQL::STRING_TYPE, argument :foo_arg, GraphQL::Types::String,
required: false, required: false,
description: 'The argument.', description: 'The argument.',
deprecated: { reason: 'Bad argument', milestone: '101.2' } deprecated: { reason: 'Bad argument', milestone: '101.2' }
...@@ -257,19 +257,19 @@ RSpec.describe Tooling::Graphql::Docs::Renderer do ...@@ -257,19 +257,19 @@ RSpec.describe Tooling::Graphql::Docs::Renderer do
description 'A thing we used to use, but no longer support' description 'A thing we used to use, but no longer support'
field :foo, field :foo,
type: GraphQL::STRING_TYPE, type: GraphQL::Types::String,
null: false, null: false,
deprecated: { reason: 'This is deprecated', milestone: '1.10' }, deprecated: { reason: 'This is deprecated', milestone: '1.10' },
description: 'A description.' description: 'A description.'
field :foo_with_args, field :foo_with_args,
type: GraphQL::STRING_TYPE, type: GraphQL::Types::String,
null: false, null: false,
deprecated: { reason: 'Do not use', milestone: '1.10', replacement: 'X.y' }, deprecated: { reason: 'Do not use', milestone: '1.10', replacement: 'X.y' },
description: 'A description.' do description: 'A description.' do
argument :arg, GraphQL::INT_TYPE, required: false, description: 'Argity' argument :arg, GraphQL::Types::Int, required: false, description: 'Argity'
end end
field :bar, field :bar,
type: GraphQL::STRING_TYPE, type: GraphQL::Types::String,
null: false, null: false,
description: 'A description.', description: 'A description.',
deprecated: { deprecated: {
...@@ -328,7 +328,7 @@ RSpec.describe Tooling::Graphql::Docs::Renderer do ...@@ -328,7 +328,7 @@ RSpec.describe Tooling::Graphql::Docs::Renderer do
) )
end end
let(:type) { ::GraphQL::INT_TYPE } let(:type) { ::GraphQL::Types::Int }
let(:section) do let(:section) do
<<~DOC <<~DOC
### `Query.bar` ### `Query.bar`
...@@ -453,12 +453,12 @@ RSpec.describe Tooling::Graphql::Docs::Renderer do ...@@ -453,12 +453,12 @@ RSpec.describe Tooling::Graphql::Docs::Renderer do
} }
mutation.field :everything, mutation.field :everything,
type: GraphQL::STRING_TYPE, type: GraphQL::Types::String,
null: true, null: true,
description: 'What we made prettier.' description: 'What we made prettier.'
mutation.field :omnis, mutation.field :omnis,
type: GraphQL::STRING_TYPE, type: GraphQL::Types::String,
null: true, null: true,
description: 'What we made prettier.', description: 'What we made prettier.',
deprecated: { deprecated: {
...@@ -516,7 +516,7 @@ RSpec.describe Tooling::Graphql::Docs::Renderer do ...@@ -516,7 +516,7 @@ RSpec.describe Tooling::Graphql::Docs::Renderer do
let(:type) do let(:type) do
Class.new(::Types::BaseObject) do Class.new(::Types::BaseObject) do
graphql_name 'Foo' graphql_name 'Foo'
field :wibble, type: ::GraphQL::INT_TYPE, null: true do field :wibble, type: ::GraphQL::Types::Int, null: true do
argument :date_range, argument :date_range,
type: ::Types::TimeframeInputType, type: ::Types::TimeframeInputType,
required: true, required: true,
...@@ -547,10 +547,10 @@ RSpec.describe Tooling::Graphql::Docs::Renderer do ...@@ -547,10 +547,10 @@ RSpec.describe Tooling::Graphql::Docs::Renderer do
let(:type) do let(:type) do
user = Class.new(::Types::BaseObject) user = Class.new(::Types::BaseObject)
user.graphql_name 'User' user.graphql_name 'User'
user.field :user_field, ::GraphQL::STRING_TYPE, null: true user.field :user_field, ::GraphQL::Types::String, null: true
group = Class.new(::Types::BaseObject) group = Class.new(::Types::BaseObject)
group.graphql_name 'Group' group.graphql_name 'Group'
group.field :group_field, ::GraphQL::STRING_TYPE, null: true group.field :group_field, ::GraphQL::Types::String, null: true
union = Class.new(::Types::BaseUnion) union = Class.new(::Types::BaseUnion)
union.graphql_name 'UserOrGroup' union.graphql_name 'UserOrGroup'
...@@ -561,7 +561,7 @@ RSpec.describe Tooling::Graphql::Docs::Renderer do ...@@ -561,7 +561,7 @@ RSpec.describe Tooling::Graphql::Docs::Renderer do
interface.include(::Types::BaseInterface) interface.include(::Types::BaseInterface)
interface.graphql_name 'Flying' interface.graphql_name 'Flying'
interface.description 'Something that can fly.' interface.description 'Something that can fly.'
interface.field :flight_speed, GraphQL::INT_TYPE, null: true, description: 'Speed in mph.' interface.field :flight_speed, GraphQL::Types::Int, null: true, description: 'Speed in mph.'
african_swallow = Class.new(::Types::BaseObject) african_swallow = Class.new(::Types::BaseObject)
african_swallow.graphql_name 'AfricanSwallow' african_swallow.graphql_name 'AfricanSwallow'
......
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