-
Notifications
You must be signed in to change notification settings - Fork 194
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
entgql: support SkipMutationCreateInput (and update) on entity #598
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Before this change, when SkipMutationCreateInput was annotated on an entity, the CreateXxxInput was omitted from the gql_mutation_input.go generated types, but still included in the ent.graphql generated schema. The same was true for SkipMutationUpdateInput. To work around this, you could use entgql.Mutations to select only the ones you want generated. But, according to the annotation comments, using SkipMutationCreateInput in this way should be supported. This change adds the proper checks to buildMutationInputs to omit the specified mutation inputs from the GraphQL schema.
giautm
approved these changes
Jul 24, 2024
Thank you for your contribution |
github-merge-queue bot
referenced
this pull request
in infratographer/x
Aug 8, 2024
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [entgo.io/contrib](https://togithub.com/ent/contrib) | `v0.4.5` -> `v0.6.0` | [![age](https://developer.mend.io/api/mc/badges/age/go/entgo.io%2fcontrib/v0.6.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/go/entgo.io%2fcontrib/v0.6.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/go/entgo.io%2fcontrib/v0.4.5/v0.6.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/entgo.io%2fcontrib/v0.4.5/v0.6.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>ent/contrib (entgo.io/contrib)</summary> ### [`v0.6.0`](https://togithub.com/ent/contrib/releases/tag/v0.6.0) [Compare Source](https://togithub.com/ent/contrib/compare/v0.5.0...v0.6.0) #### What's Changed - all: update gqlgen pkg by [@​ronenlu](https://togithub.com/ronenlu) in [/~https://github.com/ent/contrib/pull/583](https://togithub.com/ent/contrib/pull/583) - entgql/template: improve goimports time by adding missing imports by [@​a8m](https://togithub.com/a8m) in [/~https://github.com/ent/contrib/pull/584](https://togithub.com/ent/contrib/pull/584) - ci: use node20 actions because node16 actions are deprecated by [@​Arthur1](https://togithub.com/Arthur1) in [/~https://github.com/ent/contrib/pull/588](https://togithub.com/ent/contrib/pull/588) - all: bump ent and atlas to latest version by [@​giautm](https://togithub.com/giautm) in [/~https://github.com/ent/contrib/pull/596](https://togithub.com/ent/contrib/pull/596) - entgql: add annotation Deprecated for deprecated field by [@​luantranminh](https://togithub.com/luantranminh) in [/~https://github.com/ent/contrib/pull/595](https://togithub.com/ent/contrib/pull/595) - entgql: support SkipMutationCreateInput (and update) on entity by [@​freb](https://togithub.com/freb) in [/~https://github.com/ent/contrib/pull/598](https://togithub.com/ent/contrib/pull/598) #### New Contributors - [@​ronenlu](https://togithub.com/ronenlu) made their first contribution in [/~https://github.com/ent/contrib/pull/583](https://togithub.com/ent/contrib/pull/583) - [@​Arthur1](https://togithub.com/Arthur1) made their first contribution in [/~https://github.com/ent/contrib/pull/588](https://togithub.com/ent/contrib/pull/588) - [@​luantranminh](https://togithub.com/luantranminh) made their first contribution in [/~https://github.com/ent/contrib/pull/595](https://togithub.com/ent/contrib/pull/595) - [@​freb](https://togithub.com/freb) made their first contribution in [/~https://github.com/ent/contrib/pull/598](https://togithub.com/ent/contrib/pull/598) **Full Changelog**: ent/contrib@v0.5.0...v0.6.0 ### [`v0.5.0`](https://togithub.com/ent/contrib/compare/v0.4.5...v0.5.0) [Compare Source](https://togithub.com/ent/contrib/compare/v0.4.5...v0.5.0) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View the [repository job log](https://developer.mend.io/github/infratographer/x). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC4yMC4xIiwidXBkYXRlZEluVmVyIjoiMzguMjAuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before this change, when SkipMutationCreateInput was annotated on an entity, the CreateXxxInput was omitted from the
gql_mutation_input.go
generated types, but still included in theent.graphql
generated schema. The same was true for SkipMutationUpdateInput.To work around this, you could use entgql.Mutations to select only the ones you want generated. But, according to the annotation comments, using SkipMutationCreateInput in this way should be supported.
For example, this works as expected:
While this does not (it still generates CreateFileInput in ent.graphql):
This change adds the proper checks to buildMutationInputs to omit the specified mutation inputs from the GraphQL schema.
There are no entities in the example code using a skip annotation at the entity level.