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

feat: support generating correct types for @oneOf input types #7886

Merged
merged 9 commits into from
Jun 6, 2022

Conversation

n1ru4l
Copy link
Collaborator

@n1ru4l n1ru4l commented May 25, 2022

Support for the @oneOf directive on input object types.

Things to consider:

  • Should we make this available behind a flag?

    @onOf is still in the RFC stage and the behavior could change slightly. Should we, therefore, make this opt-in?


References:

@changeset-bot
Copy link

changeset-bot bot commented May 25, 2022

🦋 Changeset detected

Latest commit: b4cf959

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 41 packages
Name Type
@graphql-codegen/visitor-plugin-common Minor
@graphql-codegen/typescript Minor
@graphql-codegen/flow Patch
@graphql-codegen/flow-operations Patch
@graphql-codegen/flow-resolvers Patch
@graphql-codegen/java-apollo-android Patch
@graphql-codegen/java-common Patch
@graphql-codegen/java Patch
@graphql-codegen/kotlin Patch
@graphql-codegen/java-resolvers Patch
@graphql-codegen/c-sharp-operations Patch
@graphql-codegen/c-sharp Patch
@graphql-codegen/typescript-apollo-angular Patch
@graphql-codegen/typescript-apollo-client-helpers Patch
@graphql-codegen/typescript-document-nodes Patch
@graphql-codegen/typescript-generic-sdk Patch
@graphql-codegen/gql-tag-operations Patch
@graphql-codegen/typescript-graphql-request Patch
@graphql-codegen/typescript-jit-sdk Patch
@graphql-codegen/typescript-mongodb Patch
@graphql-codegen/typescript-msw Patch
@graphql-codegen/typescript-oclif Patch
@graphql-codegen/typescript-operations Patch
@graphql-codegen/typescript-react-offix Patch
@graphql-codegen/typescript-react-apollo Patch
@graphql-codegen/typescript-react-query Patch
@graphql-codegen/typescript-resolvers Patch
@graphql-codegen/typescript-rtk-query Patch
@graphql-codegen/typescript-stencil-apollo Patch
@graphql-codegen/typescript-type-graphql Patch
@graphql-codegen/typed-document-node Patch
@graphql-codegen/typescript-urql-graphcache Patch
@graphql-codegen/urql-svelte-operations-store Patch
@graphql-codegen/typescript-urql Patch
@graphql-codegen/typescript-vue-apollo-smart-ops Patch
@graphql-codegen/typescript-vue-apollo Patch
@graphql-codegen/typescript-vue-urql Patch
@graphql-codegen/jsdoc Patch
@graphql-codegen/graphql-modules-preset Patch
@graphql-codegen/import-types-preset Patch
@graphql-codegen/near-operation-file-preset Patch

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

@vercel
Copy link

vercel bot commented May 25, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
graphql-code-generator ✅ Ready (Inspect) Visit Preview May 26, 2022 at 10:02AM (UTC)

@theguild-bot
Copy link
Collaborator

theguild-bot commented May 25, 2022

The latest changes of this PR are available as alpha in npm (based on the declared changesets):

@graphql-codegen/c-sharp@4.2.13-alpha-3f97058d3.0
@graphql-codegen/c-sharp-operations@2.2.12-alpha-3f97058d3.0
@graphql-codegen/flow@2.2.12-alpha-3f97058d3.0
@graphql-codegen/flow-operations@2.2.12-alpha-3f97058d3.0
@graphql-codegen/flow-resolvers@2.2.13-alpha-3f97058d3.0
@graphql-codegen/java-apollo-android@2.2.12-alpha-3f97058d3.0
@graphql-codegen/java-common@2.1.19-alpha-3f97058d3.0
@graphql-codegen/java@3.2.13-alpha-3f97058d3.0
@graphql-codegen/kotlin@2.2.13-alpha-3f97058d3.0
@graphql-codegen/java-resolvers@2.2.12-alpha-3f97058d3.0
@graphql-codegen/jsdoc@2.2.12-alpha-3f97058d3.0
@graphql-codegen/visitor-plugin-common@2.9.0-alpha-3f97058d3.0
@graphql-codegen/typescript-apollo-angular@3.4.11-alpha-3f97058d3.0
@graphql-codegen/typescript-apollo-client-helpers@2.1.19-alpha-3f97058d3.0
@graphql-codegen/typescript-document-nodes@2.2.12-alpha-3f97058d3.0
@graphql-codegen/typescript-generic-sdk@2.3.11-alpha-3f97058d3.0
@graphql-codegen/gql-tag-operations@1.2.15-alpha-3f97058d3.0
@graphql-codegen/typescript-graphql-apollo@1.1.2-alpha-3f97058d3.0
@graphql-codegen/typescript-graphql-request@4.4.9-alpha-3f97058d3.0
@graphql-codegen/typescript-jit-sdk@2.0.10-alpha-3f97058d3.0
@graphql-codegen/typescript-mongodb@2.3.10-alpha-3f97058d3.0
@graphql-codegen/typescript-msw@1.0.11-alpha-3f97058d3.0
@graphql-codegen/typescript-oclif@2.2.12-alpha-3f97058d3.0
@graphql-codegen/typescript-operations@2.4.1-alpha-3f97058d3.0
@graphql-codegen/typescript-react-apollo@3.2.15-alpha-3f97058d3.0
@graphql-codegen/typescript-react-offix@2.2.12-alpha-3f97058d3.0
@graphql-codegen/typescript-react-query@3.5.13-alpha-3f97058d3.0
@graphql-codegen/typescript-resolvers@2.6.5-alpha-3f97058d3.0
@graphql-codegen/typescript-rtk-query@2.2.13-alpha-3f97058d3.0
@graphql-codegen/typescript-stencil-apollo@2.2.12-alpha-3f97058d3.0
@graphql-codegen/typescript-type-graphql@2.2.13-alpha-3f97058d3.0
@graphql-codegen/typed-document-node@2.2.12-alpha-3f97058d3.0
@graphql-codegen/typescript@2.5.0-alpha-3f97058d3.0
@graphql-codegen/typescript-urql@3.5.11-alpha-3f97058d3.0
@graphql-codegen/typescript-urql-graphcache@2.2.14-alpha-3f97058d3.0
@graphql-codegen/urql-svelte-operations-store@1.1.19-alpha-3f97058d3.0
@graphql-codegen/typescript-vue-apollo@3.2.13-alpha-3f97058d3.0
@graphql-codegen/typescript-vue-apollo-smart-ops@2.2.12-alpha-3f97058d3.0
@graphql-codegen/typescript-vue-urql@2.2.13-alpha-3f97058d3.0
@graphql-codegen/gql-tag-operations-preset@1.4.1-alpha-3f97058d3.0
@graphql-codegen/graphql-modules-preset@2.3.12-alpha-3f97058d3.0
@graphql-codegen/import-types-preset@2.1.19-alpha-3f97058d3.0
@graphql-codegen/near-operation-file-preset@2.2.13-alpha-3f97058d3.0

@benjie
Copy link
Contributor

benjie commented May 26, 2022

oneOf requires that all fields are nullable in the schema, and promises/requires that exactly one will be non-null at run time. You have tests for non-null fields on a oneOf; that’s expressly forbidden in the spec.

@n1ru4l n1ru4l merged commit c3d7b72 into master Jun 6, 2022
@n1ru4l n1ru4l deleted the feat-one-of-input branch June 6, 2022 01:35
@purkhusid
Copy link

@n1ru4l @dotansimha Can this change be published in a prerelease?

@ardatan
Copy link
Collaborator

ardatan commented Jun 7, 2022

@purkhusid You can use the versions here;
#7886 (comment)

@purkhusid
Copy link

@ardatan Ah, thought some commits were missing from that release but it seems like everything is there. Thanks!

@levrik
Copy link
Contributor

levrik commented Jul 4, 2022

Sadly this is breaking for me and blocking me from upgrading in general, see #7938

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.

7 participants