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

Generate typed interfaces for gql interfaces & unions #335

Merged
merged 3 commits into from
Oct 2, 2018
Merged

Conversation

lwc
Copy link
Member

@lwc lwc commented Sep 10, 2018

Adds signpost methods to generated interfaces that models must implement, giving us type safety of interfaces & unions.

Also generates those methods on generated models, so they're still valid.

Closes: #333

RFC probably doesn't handle the case where the interface is not generated, but the models are, what should happen there?

  • This case is actually kind of insane, so upon further thought let's not handle it.

Also updates the interface implementor check to use go/types.Implements which catches a few edge cases like described in #169.

I have:

  • Added tests covering the bug / feature (see testing)
  • Updated any relevant documentation (see docs)

Copy link
Collaborator

@vektah vektah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lwc lwc merged commit bc35d73 into master Oct 2, 2018
@vektah vektah deleted the typed-interfaces branch October 2, 2018 03:11
cgxxv pushed a commit to cgxxv/gqlgen that referenced this pull request Mar 25, 2022
Generate typed interfaces for gql interfaces & unions
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

Successfully merging this pull request may close these issues.

2 participants