graphql-code-generator
graphql-code-generator copied to clipboard
Regression w.r.t. aliases and conditional inline fragments in @graphql-codegen/[email protected]
Which packages are impacted by your issue?
@graphql-codegen/visitor-plugin-common
Describe the bug
With of @graphql-codegen/[email protected]
, is seems that when an aliased object field and a conditional inline fragment are used side-by-side in a query, the aliased object field is made optional, instead of the fields in the conditional inline fragment. My guess would be that this is caused by the changes in https://github.com/dotansimha/graphql-code-generator/pull/9842.
Your Example Website or App
https://codesandbox.io/p/devbox/quirky-minsky-qllmxx
Steps to Reproduce the Bug or Issue
See the schema.graphql
and document.graphql
in the provided code sandbox. Observe the types.ts
obtained by running graphql-codegen
. In the UserQuery
type, the email
property of user
is not optional, but addressAlias
is optional.
Expected behavior
I would expect email
to be optional and addressAlias
to be not optional.
Screenshots or Videos
No response
Platform
- OS: Linux
- NodeJS: 18.17.1
-
graphql
version: 16.8.1 -
@graphql-codegen/visitor-plugin-common
version: 5.1.0
Codegen Config File
No response
Additional context
No response