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

@oneOf support broken with interfaces #7938

Closed
3 of 4 tasks
levrik opened this issue Jun 14, 2022 · 3 comments · Fixed by #8586
Closed
3 of 4 tasks

@oneOf support broken with interfaces #7938

levrik opened this issue Jun 14, 2022 · 3 comments · Fixed by #8586
Labels
core Related to codegen core/cli kind/bug Bug :-( stage/1-reproduction A reproduction exists

Comments

@levrik
Copy link
Contributor

levrik commented Jun 14, 2022

Issue workflow progress

Progress of the issue based on the Contributor Workflow

Make sure to fork this template and run yarn generate in the terminal.

Please make sure the Codegen and plugins version under package.json matches yours.

  • 2. A failing test has been provided
  • 3. A local solution has been provided
  • 4. A pull request is pending review

Describe the bug

To Reproduce
Steps to reproduce the behavior:

Here's a sandbox showing the broken output:

https://codesandbox.io/s/kind-proskuriakova-h2i4te?file=/types.ts

  1. My GraphQL schema:
directive @oneOf on INPUT_OBJECT

input IntFilterInput @oneOf {
  eq: Int
  ne: Int
  gt: Int
  gte: Int
  lt: Int
  lte: Int
  in: [Int]
}
  1. My codegen.yml config file:
schema: schema.graphql
generates:
  types.ts:
    config:
      declarationKind: interface
    plugins:
      - typescript

Expected behavior

To don't generate invalid TypeScript code.

More specifically either override the interface setting and use type or fall back to no special @oneOf handling.

Environment:

  • @graphql-codegen/typescript: 2.4.2
@n1ru4l
Copy link
Collaborator

n1ru4l commented Jul 4, 2022

@levrik Do you think you can create a pull request with a failing test case for this?

@levrik
Copy link
Contributor Author

levrik commented Jul 4, 2022

@n1ru4l Since I'm quite busy with other things right now, I hope the linked CodeSandbox above is enough for now.
I'll see what I can do if I have a free minute.

@n1ru4l n1ru4l added the stage/1-reproduction A reproduction exists label Jul 4, 2022
@charlypoly charlypoly added the core Related to codegen core/cli label Nov 3, 2022
@levrik
Copy link
Contributor Author

levrik commented Nov 8, 2022

I've suggested a fix in #8586

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Related to codegen core/cli kind/bug Bug :-( stage/1-reproduction A reproduction exists
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants