You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
When 2 subtypes of the same union type share a field but with a different value type, it's possible to run into query-time errors like below if the client doesn't alias the field with conflicting value types:
Minimal reproducible setup where a Book is either a Novel or a Poem but their id field is Drn and Int respectively.
Creating such scenario in a schema isn't forbidden per se but it would be nice to have the option of enforcing a linting rule preventing it in the first place. The rule would suggest renaming the field(s) in the conflicting subtype(s).
Describe alternatives you've considered
apollographql/eslint-plugin-graphql but the tool is also missing a rule for this scenario.
Additional context
–
The text was updated successfully, but these errors were encountered:
caccialdo
changed the title
New rule request: union subtypes with conflicting key value type
New rule request: union subtypes with conflicting field value type
Nov 14, 2023
Thanks @dimaMachina ! It does look like this is the linting rule used in the playground indeed (cf. original screenshot in the ticket description). I'll look into leveraging it in our clients.
I think the feature request is still valid though as enforcing it on the server-side at the schema level (vs. operation level) would be valuable for clients lacking linting capabilities.
Is your feature request related to a problem? Please describe.
When 2 subtypes of the same union type share a field but with a different value type, it's possible to run into query-time errors like below if the client doesn't alias the field with conflicting value types:
Minimal reproducible setup where a
Book
is either aNovel
or aPoem
but theirid
field isDrn
andInt
respectively.Sample schema
Describe the solution you'd like
Creating such scenario in a schema isn't forbidden per se but it would be nice to have the option of enforcing a linting rule preventing it in the first place. The rule would suggest renaming the field(s) in the conflicting subtype(s).
Describe alternatives you've considered
apollographql/eslint-plugin-graphql
but the tool is also missing a rule for this scenario.Additional context
–
The text was updated successfully, but these errors were encountered: