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

New broken prelude.resolvers.go file with v0.17.0 #2026

Open
nathani-axis opened this issue Mar 2, 2022 · 14 comments
Open

New broken prelude.resolvers.go file with v0.17.0 #2026

nathani-axis opened this issue Mar 2, 2022 · 14 comments

Comments

@nathani-axis
Copy link

What happened?

Since v0.17.0, running gqlgen throws some errors:

Error: validation failed: packages.Load: <repo>/graph/prelude.resolvers.go:23:41: __SchemaResolver not exported by package generated
Error: <repo>/graph/prelude.resolvers.go:26:39: __TypeResolver not exported by package generated

It generates a prelude.resolvers.go file that is not generated in v0.16.0, which seems to have some errors in it.

What did you expect?

gqlgen v0.17.0 generates the same proper files as gqlgen v0.16.0, without errors.

Minimal graphql.schema and models to reproduce

type Object {
  id: ID!
  text: String!
}

input NewObject {
  text: String!
}

type Mutation {
  createObject(input: NewObject!): Object!
}

versions

  • go run github.com/99designs/gqlgen version: v0.17.0 (latest as of writing this issue)
  • go version: go version go1.16.1 linux/amd64
@Code-Hex
Copy link
Contributor

Code-Hex commented Mar 2, 2022

@nathani-axis Could you share me your gqlgen.yml and your go.mod? (I supported around prelude maybe I can understand why happened) Thanks

@Code-Hex
Copy link
Contributor

Code-Hex commented Mar 7, 2022

Probably this link help you #2018

@frederikhors
Copy link
Collaborator

I think we can close this. Please @nathani-axis speak with us...

@zmitry
Copy link

zmitry commented Mar 16, 2022

I'm on the latest version from master for gqlparser and gqlgen and still have this
github.com/vektah/gqlparser/v2 v2.4.2-0.20220315005344-931cd7644eee
github.com/99designs/gqlgen v0.17.2-0.20220316114301-87fc5f22e8fb

image

@NickDiPreta
Copy link

NickDiPreta commented Mar 16, 2022

I have the same problems. Doesn't work for anyone at our org at the moment. edit: apologies, was easily resolved using comment abovego get -d github.com/99designs/gqlgen@master @frederikhors

@frederikhors
Copy link
Collaborator

Can you please create a MINIMAL reproduction? This is crazy. Here no problems at all!

@zmitry
Copy link

zmitry commented Mar 16, 2022

@frederikhors I figured it out, errors are confusing, in enums if your are using autobinding and didn't implement marshalling and unmarshalling generated code is broken with such weird error.

@zmitry
Copy link

zmitry commented Mar 16, 2022

It seems to be tough to make minimal reproduction since I have huge package with lots of types, but once I removed autobind and did manual binding it works ok

@frederikhors
Copy link
Collaborator

Ok. We are not using the TRAGIC autobind feature here.

What can we do to improve errors?

@zmitry
Copy link

zmitry commented Mar 16, 2022

I guess we need somehow detect that fields that we are binding are implementing marshalling methods.

@oneuid
Copy link

oneuid commented Mar 17, 2022

run go get github.com/vektah/gqlparser/[email protected]

@sdemjanenko
Copy link

sdemjanenko commented Oct 13, 2023

I just encountered something really similar when upgrading from 0.17.38 to 0.17.39. I had to back out the upgrade because I didn't have time to debug.

@giautm
Copy link
Contributor

giautm commented Feb 8, 2024

Hey, I ran into this issue when I upgraded entgql to use v0.17.39.

Edit: I'm wrong, this PR causes the issue on v0.17.39: #2812

Edit: In our case, we already have the type Field, which wasn't binding to the Field interface of GQL. The Field interface is from schema github.com/99designs/gqlgen/graphql/introspection.Field. After that PR, the logic was changed and it bound to our type and generated a lot of incorrect interfaces.

Edit: Link a solution #227 (comment)

@gurkanguray
Copy link

I had the same issue, and I wasn't able to upgrade the gqlgen version anymore. All >= v0.17.39 versions were broken for me and getting weird interfaces such as __Field() __FieldResolver and __Type() __TypeResolver.

Thanks to the #227 (comment), adding the github.com/99designs/gqlgen/graphql/introspection as a first autobind to gqlgen.yml file apparently is the only fix for now.

autobind:

  • github.com/99designs/gqlgen/graphql/introspection

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

9 participants