-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Only generate Exact utility type if documents have operations
#10571
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
Conversation
🦋 Changeset detectedLatest commit: 42d82df The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
| mutation MakeAdmin { | ||
| makeUserAdmin(id: "100") { | ||
| ...UserFragment | ||
| } | ||
| } | ||
| subscription UserChanges { | ||
| makeUserAdmin(id: "100") { | ||
| ...UserFragment | ||
| } | ||
| } | ||
| fragment UserFragment on User { | ||
| id | ||
| role | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding these to make sure we test many things in the default test.
This gives more confidence overall.
e.g. in this PR I want to make sure Exact is used for mutation and subscription variables.
| type ResponseError { | ||
| error: ResponseErrorType! | ||
| } | ||
| enum ResponseErrorType { | ||
| NOT_FOUND | ||
| INPUT_VALIDATION_ERROR | ||
| FORBIDDEN_ERROR | ||
| UNEXPECTED_ERROR | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extraneous and never used in this test, so removed.
🚀 Snapshot Release (
|
| Package | Version | Info |
|---|---|---|
@graphql-codegen/cli |
6.1.1-alpha-20260113134512-42d82dfa5bd5d9a89b285c06f6591dca2a782062 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/introspection |
5.0.1-alpha-20260113134512-42d82dfa5bd5d9a89b285c06f6591dca2a782062 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/visitor-plugin-common |
7.0.0-alpha-20260113134512-42d82dfa5bd5d9a89b285c06f6591dca2a782062 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/typescript-document-nodes |
5.0.8-alpha-20260113134512-42d82dfa5bd5d9a89b285c06f6591dca2a782062 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/gql-tag-operations |
5.1.3-alpha-20260113134512-42d82dfa5bd5d9a89b285c06f6591dca2a782062 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/typescript-operations |
6.0.0-alpha-20260113134512-42d82dfa5bd5d9a89b285c06f6591dca2a782062 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/typescript-resolvers |
6.0.0-alpha-20260113134512-42d82dfa5bd5d9a89b285c06f6591dca2a782062 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/typed-document-node |
6.1.6-alpha-20260113134512-42d82dfa5bd5d9a89b285c06f6591dca2a782062 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/typescript |
6.0.0-alpha-20260113134512-42d82dfa5bd5d9a89b285c06f6591dca2a782062 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/client-preset |
6.0.0-alpha-20260113134512-42d82dfa5bd5d9a89b285c06f6591dca2a782062 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/graphql-modules-preset |
5.1.3-alpha-20260113134512-42d82dfa5bd5d9a89b285c06f6591dca2a782062 |
npm ↗︎ unpkg ↗︎ |
Description
Exactutility is only used to wrap variables types for operations (queries, mutations and subscriptions) if they exist in the document.Exactis never used for when there are fragments.This is important to conditionally generate as users may use very strict tsconfig that will fail compiling if there are unused types.
This PR ensures
Exactis conditionally generated: only generated when there are operations.Related #10496
Type of change
How Has This Been Tested?