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

Illegal enum values #2207

Open
romshark opened this issue May 25, 2022 · 5 comments
Open

Illegal enum values #2207

romshark opened this issue May 25, 2022 · 5 comments
Labels
enhancement New feature or request

Comments

@romshark
Copy link

What happened?

Illegal enum values are accepted during code generation.
When you run the server and open the playground it says:

{
  "errors": [
    "Enum values cannot be named: true"
  ]
}

What did you expect?

I expect go run github.com/99designs/gqlgen to return an error when reading the schema file and encountering true, false or null in enum values according to the spec of October 2021.

Minimal graphql.schema and models to reproduce

https://github.com/romshark/gqlgen-2207-reproduction

versions

  • go run github.com/99designs/gqlgen version: v0.17.7
  • go version: go1.18.2 darwin/arm64
@ameyarao98
Copy link
Contributor

This is an issue on https://github.com/vektah/gqlparser, and has been fixed with the following PR:
vektah/gqlparser#227

@frederikhors
Copy link
Collaborator

@romshark can you please verify?

@frederikhors
Copy link
Collaborator

@ameyarao98 thanks.

@romshark
Copy link
Author

@romshark can you please verify?

I've upgraded the reproduction example to master (53ca207) but go generate still won't fail so this issue remains open. The PR for vektah/gqlparser looks good to me.

@frederikhors frederikhors added the enhancement New feature or request label Jun 28, 2022
@ameyarao98
Copy link
Contributor

ameyarao98 commented Jun 30, 2022

@romshark gqlgen has not been updated to use the version of the gqlpraser that has this fix. To test this, clone master of https://github.com/vektah/gqlparser, add the following to the go.mod of your reproduction example

replace github.com/vektah/gqlparser/v2 => <path to cloned gqlparser>

and then run the generation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants