Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add failing test for directives with input cycles #3472

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions spec/graphql/schema/build_from_definition_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,32 @@ def assert_schema_and_compare_output(definition)
assert_schema_and_compare_output(schema.chop)
end

it 'can build a schema with directives whose inputs have a cycle' do
schema = <<-SCHEMA
schema {
query: Hello
}

directive @foo(arg: InputA) on FIELD

input InputA {
value: InputB
}

input InputB {
value: InputA
}
SCHEMA

parsed_schema = GraphQL::Schema.from_definition(schema)
assert_equal ["deprecated", "foo", "include", "skip"], parsed_schema.directives.keys.sort
parsed_schema.directives.values.each do |dir_class|
assert dir_class < GraphQL::Schema::Directive
end

assert_schema_and_compare_output(schema.chop)
end

it 'supports descriptions and definition_line' do
schema = <<-SCHEMA
schema {
Expand Down