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

Name "__name__" must not begin with "__", which is reserved by GraphQL introspection.exit status 1 #1228

Closed
c3p0xrt opened this issue Jun 26, 2020 · 1 comment

Comments

@c3p0xrt
Copy link

c3p0xrt commented Jun 26, 2020

What happened?

I added a field __name__ in my schema.graphqls file:

type Person {
__name__: String
age: Int
}

I ran go generate to generate the corresponding model and got this error:

failed to load schema: internal/pkg/graph/schema.graphqls:21: Name "__name__" must not begin with "__", 
which is reserved by GraphQL introspection.exit status 1

The response from upstream service has the __name__ field.

What did you expect?

I expect to be able to use the __name__ field in the schema. If there is some way around this, that can be helpful too.

Minimal graphql.schema and models to reproduce

type Person {
__name__: String
age: Int
}

versions

  • gqlgen version? v0.11.3
  • go version? go version go1.14.2 linux/amd64
  • dep or go modules? go mod.
@lwc
Copy link
Member

lwc commented Jul 8, 2020

This is not allowed as per the GraphQL specification.

See http://spec.graphql.org/draft/#sec-Objects.Type-Validation and graphql/graphql-spec#244

@lwc lwc closed this as completed Jul 8, 2020
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

2 participants