Closed PeterZainzinger closed 5 years ago
We accoutered another problem with the dart types. Consider the following graphql definition:
type Query { getFoo(id: String!): String getBar(id: String!): String }
The generated code will be:
class Query { @JsonKey(required: true, disallowNullValue: true,) String getFoo; @JsonKey(required: true, disallowNullValue: true,) String getBar; .... }
The required JsonKeys are a problem in this case because we query getFoo XOR getBar, so the fromJSON will throw an error.
getFoo
getBar
fromJSON
My workaround is just to make all fields in the types Query, Mutation and Subscription non required.
Query
Mutation
Subscription
published 👍
We accoutered another problem with the dart types. Consider the following graphql definition:
The generated code will be:
The required JsonKeys are a problem in this case because we query
getFoo
XORgetBar
, so thefromJSON
will throw an error.My workaround is just to make all fields in the types
Query
,Mutation
andSubscription
non required.