Skip to content

Better Support for @oneof Input Directive #10524

@hueter

Description

@hueter

Is your feature request related to a problem? Please describe.

Hello,

I just wanted to flag that the typescript and schema-ast plugins don't seem to fully support the @oneOf directive for input types.

I have an example repository here with a minimal reproduction of the issue I'm facing.

The backend (GraphQL Ruby - docs) correctly adds the @oneof to an input, but the code generated ignores it.

schema-ast plugin output:

https://github.com/hueter/graphql-codegen-input-oneof/blob/c8bd4bd0e49b5f0bfd41e72a0d20e7627a55c0a6/generated/schema.graphql#L15-L20

typescript plugin output:

https://github.com/hueter/graphql-codegen-input-oneof/blob/c8bd4bd0e49b5f0bfd41e72a0d20e7627a55c0a6/generated/types.ts#L31-L36

codegen configs:

https://github.com/hueter/graphql-codegen-input-oneof/blob/c8bd4bd0e49b5f0bfd41e72a0d20e7627a55c0a6/codegen.ts#L3-L19

Describe the solution you'd like

I was hoping that it would output a TypeScript discriminated union as well as include the @oneof directive in the generated schema. I saw this issue which talked about (an imaginary?) config but couldn't see it documented / not sure if it's real.

Describe alternatives you've considered

No response

Any additional important details?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions