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

Problem with @deprecated directive in input fields #1636

Closed
VictorAssunc opened this issue Sep 28, 2021 · 12 comments · Fixed by #1857
Closed

Problem with @deprecated directive in input fields #1636

VictorAssunc opened this issue Sep 28, 2021 · 12 comments · Fixed by #1857

Comments

@VictorAssunc
Copy link

What happened?

After upgrading gqlgen (v0.13.0 -> v0.14.0), when trying to generate models, I got an error related to the @deprecated directive in input fields. I was checking and I'm not sure if it's a gqlgen or gqlparser bug (this second I don't think it's because they updated this directive in a recent commit).

This error did not happen in the previous version (v0.13.0).

What did you expect?

Generate models without problems

Minimal graphql.schema and models to reproduce

input NewUserInput {
  email: String!
  password: String!
  name: String @deprecated(reason: "No longer supported")
}

versions

  • gqlgen version? v0.14.0
  • go version? go version go1.17 linux/amd64
  • dep or go modules? go mod
@bickyeric
Copy link
Contributor

i try to debug this issue, i'm pretty sure this is gqlparser bug on this commit vektah/gqlparser@375e4cf, bug fix already merged but unfortunately not included on gqlparser@v2.2.0 which is used on gqlgen@0.14.0.

i hope gqlparser maintainer can create new release so we can add it into gqlgen v0.15.0 or gqlgen v.0.14.1

@britztopher
Copy link

This is definitely keeping me from updating as we use the deprecated directive all over our schema

@BatmanAoD
Copy link

Here's the request for a new release in gqlparser: vektah/gqlparser#165

@macnibblet
Copy link

That issue has been open for a while, maybe we should fork the gqlparser into 99designs?

StevenACoffman added a commit that referenced this issue Jan 26, 2022
Signed-off-by: Steve Coffman <steve@khanacademy.org>
StevenACoffman added a commit that referenced this issue Jan 26, 2022
Signed-off-by: Steve Coffman <steve@khanacademy.org>
@StevenACoffman
Copy link
Collaborator

StevenACoffman commented Jan 26, 2022

I cut a new release for gqlparser, but it appears not to be that easy as it looks like the very first merge after the v2.2.0 release causes problems in gqlgen generate.

StevenACoffman added a commit that referenced this issue Jan 26, 2022
Signed-off-by: Steve Coffman <steve@khanacademy.org>
StevenACoffman added a commit that referenced this issue Jan 26, 2022
Signed-off-by: Steve Coffman <steve@khanacademy.org>
@StevenACoffman
Copy link
Collaborator

Sorry this took so long. Should be good now!

@macnibblet
Copy link

Thank you sooo much!

@BatmanAoD
Copy link

This works! Thank you!

How soon do you expect a new release of gqlgen to be cut?

@imjma
Copy link

imjma commented Feb 1, 2024

The error is not happening
But when I tested, there is no deprecated info in the schema or GraohpiQL documentation explorer.

@slightlytyler
Copy link

Yep it appears that the codegen supports this now but not the runtime introspection behavior

@StevenACoffman
Copy link
Collaborator

PRs welcome!

@carldunham
Copy link
Contributor

carldunham commented Apr 23, 2024

fwiw, this is only supported in the working draft gql spec: https://spec.graphql.org/draft/#sec--deprecated. The current spec only allows @deprecated on fields and enums. It may not play nicely with other tooling and/or clients.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
9 participants