What happened?
I got error while applying http://github.com/Yamashou/gqlgenc to my schemas.
I discovered similar issue at that repo first (gqlgo/gqlgenc#88) but traced error back to this parser.
I debugged code generation and found that my query and schema values in plugin config referenced same directory, and in this folder there is a directive file (it is first file in the directory, so it failed pretty fast), containing
directive @access(num: Int) on FIELD_DEFINITION
I use gqlgen for generating my models, and it handles such structure nicely.
However, query doc parser here is unable to handle directive token.
What did you expect?
I expect query parser not to fail, and parser to parse my directive correctly.
I might be wrong putting schema and query under same folder, but it worked for me with gqlgen server generation, and now I decided to start generating client as well.
❓ So, is it a hard requirement to keep directives out of query folder? ❓
Looks like you can only put query, mutation, subscription and fragment there.
Minimal graphql.schema and models to reproduce
put following into file in under query folder:
directive @access(num: Int) on FIELD_DEFINITION and run query parser on that document.
versions
go list -m github.com/vektah/gqlparser/v2?
took latest master aed070fd commit.
github.com/vektah/gqlparser/v2
go version?
go version go1.19.3 windows/amd64
Thank you
What happened?
I got error while applying http://github.com/Yamashou/gqlgenc to my schemas.
I discovered similar issue at that repo first (gqlgo/gqlgenc#88) but traced error back to this parser.
I debugged code generation and found that my
queryandschemavalues in plugin config referenced same directory, and in this folder there is a directive file (it is first file in the directory, so it failed pretty fast), containingdirective @access(num: Int) on FIELD_DEFINITIONI use
gqlgenfor generating my models, and it handles such structure nicely.However, query doc parser here is unable to handle
directivetoken.What did you expect?
I expect query parser not to fail, and parser to parse my directive correctly.
I might be wrong putting schema and query under same folder, but it worked for me with
gqlgenserver generation, and now I decided to start generating client as well.❓ So, is it a hard requirement to keep directives out of
queryfolder? ❓Looks like you can only put
query,mutation,subscriptionandfragmentthere.Minimal graphql.schema and models to reproduce
put following into file in under
queryfolder:directive @access(num: Int) on FIELD_DEFINITIONand run query parser on that document.versions
go list -m github.com/vektah/gqlparser/v2?took latest master
aed070fdcommit.github.com/vektah/gqlparser/v2go version?go version go1.19.3 windows/amd64Thank you