-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Parsing an SDL file with extend schema
leads to NoMethodError
(name
on GraphQL::Language::Nodes::SchemaExtension
)
#4199
Comments
Thanks for the detailed report! I think we updated the parser to handle extensions but never actually implemented loading schemas with |
I'm taking a look over at #4203. One issue is, GraphQL-Ruby can't validate Alternatively, you could lay out the directive definition in the schema class, then call graphql-ruby/spec/graphql/schema/build_from_definition_spec.rb Lines 1615 to 1636 in fd8f468
Would one of those approaches work for your use case? |
Great catch! You're right that my SDL is missing a definition for the scalar link__Import
directive @link(import: [link__Import], url: String!) on SCHEMA On a side note: I didn't realize you could define some parts of a schema in ruby, and load a definition for the rest into it--that's cool and I may use that in the future--so thanks! |
To clarify, it's actually leveraging inheritance: the directive is added to the superclass, then |
Describe the bug
Apollo requires the following in a subgraph schema for Apollo Federation V2:
However, when I try to parse an SDL file that contains this using graphql-ruby, I get a
NoMethodError
Versions
graphql
version: 2.0.14GraphQL schema
See the script below for a full runnable example of this bug.
GraphQL query
N/A
Steps to reproduce
Put this file in
tmp/graphql_ruby_bug.rb
:Then run with:
Expected behavior
This SDL string should parse without throwing any exceptions.
Actual behavior
Additional context
It looks like the
case
statement clause here is missingGraphQL::Language::Nodes::SchemaExtension
.https://github.com/rmosolgo/graphql-ruby/blob/v2.0.14/lib/graphql/schema/build_from_definition.rb#L70
If I add
GraphQL::Language::Nodes::SchemaExtension
to it, I no longer get the exception.The text was updated successfully, but these errors were encountered: