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

Unexpected Name "directive" #248

Open
glebsts opened this issue Nov 24, 2022 · 0 comments
Open

Unexpected Name "directive" #248

glebsts opened this issue Nov 24, 2022 · 0 comments

Comments

@glebsts
Copy link

glebsts commented Nov 24, 2022

What happened?

I got error while applying http://github.com/Yamashou/gqlgenc to my schemas.
I discovered similar issue at that repo first (Yamashou/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

@glebsts glebsts closed this as not planned Won't fix, can't repro, duplicate, stale Nov 24, 2022
@glebsts glebsts reopened this Nov 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant