-
Notifications
You must be signed in to change notification settings - Fork 2k
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
All astNode
fields are undefined when schema is loaded using buildClientSchema
#1575
Comments
@dotansimha Sorry for the delay.
Since If you have a different use case for
You can use const validSchema = builtSchema(printSchema(schema)); |
AST refers to abstract syntax tree which is directly derived from SDL source. If you have no source, you cannot have AST. I think that this make sense. |
One thing I think we do eventually need to solve: currently the only way to access directives placed on GraphQLSchema definitions is via the definition's AST node. In this case it's a bit of a non-issue, as the introspection query doesn't expose field-definition directives anyways. But that could be a good project for someone to improve the consistency across introspection and SDL based schemas. |
@dotansimha If you want this issue to be reopened, please free to ping me. |
Our workaround was to print and reparse the schema to have import {parse, printSchema} from 'graphql';
const schemaNode = parse(printSchema(schema)) |
I noticed an issue with loading a
GraphQLSchema
using introspection JSON.Given the following introspection JSON:
https://gist.github.com/dotansimha/c25f0ce38382086f55f5382da7dcbcb8
If I'm running the following code:
I know
buildClientSchema
should return aGraphQLSchema
without resolvers and anything else, but is there a reason for removing theastNode
fields?My current workaround is to print the schema into a
string
, parse to into aDocument
usingparse
and then build the schema again usingbuildASTSchema
:The text was updated successfully, but these errors were encountered: