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
I have an union type union Animal = Cat | Dog and a root field called animals(input: [AnimalIdsAndTypesInput!]!): [Animal]!. AnimalIdsAndTypesInput contains two fields called id and type. type can be either CAT or DOG. This field should return the cats and dogs in the same order as the input ids and types. However, depending on the order of the input array, it produces nulls for some extended fields in Cat.
In the above two queries, the only difference is the order of the two input objects.
Expected results
enemies of the Cat type should receive the expected JSON value.
Actual results
enemies of the Cat type receives null.
Additional context
I know the enemies field here can use a plan instead of custom sql execution. However, in my case it's more complex than this reproduction. Also, instead of loadMany I have tried withPgClient which returns no results, but an array of nulls.
When I said order of the fields, specifically this happens, when you put the extended type (in this case, it's the Cat type) later in the array of input objects.
The text was updated successfully, but these errors were encountered:
I'm not going to investigate this because #2301 will involve rewriting a lot of how polymorphism works and this issue will likely no longer exist afterwards. If you would like it fixed in the mean time, you will need to investigate it and implement a fix yourself - sorry!
Summary
I have an union type
union Animal = Cat | Dog
and a root field calledanimals(input: [AnimalIdsAndTypesInput!]!): [Animal]!
.AnimalIdsAndTypesInput
contains two fields calledid
andtype
.type
can be eitherCAT
orDOG
. This field should return the cats and dogs in the same order as the input ids and types. However, depending on the order of the input array, it produces nulls for some extended fields in Cat.Steps to reproduce
schema.sql
file against the database to create the cat and dog tables and insert some dummy data.Query 1
andQuery 2
.Query 1
Query 2
Expected results
enemies
of theCat
type should receive the expected JSON value.Actual results
enemies
of theCat
type receives null.Additional context
I know the enemies field here can use a plan instead of custom sql execution. However, in my case it's more complex than this reproduction. Also, instead of
loadMany
I have triedwithPgClient
which returns no results, but an array of nulls.When I said order of the fields, specifically this happens, when you put the extended type (in this case, it's the
Cat
type) later in the array of input objects.The text was updated successfully, but these errors were encountered: