When using Nodes to call an API where arguments are mutually exclusive, there is currently no way to leave out either argument even if value is not set or explicitly set to null in annotation. This is due to two issues:
a) null values are treated as String("null") instead of null values internally, while parsing value from GraphQLArgument annotation
and
b) the GraphQLArgument annotation has no notion of "!"/optional argument or not, meaning that request generation can effectively never leave out any arguments.
An example is an electricity consumption API where parameters first or last is used to get the first or last N entries from a series of consumption values. The API returns nothing on the following conditions:
consumption(resolution: HOURLY, first: null, last: 100) or consumption(resolution: HOURLY, first: 100, last: null)
The query must be either of:
consumption(resolution: HOURLY, last: 100) or consumption(resolution: HOURLY, first: 100)
When using Nodes to call an API where arguments are mutually exclusive, there is currently no way to leave out either argument even if value is not set or explicitly set to null in annotation. This is due to two issues: a) null values are treated as String("null") instead of null values internally, while parsing value from GraphQLArgument annotation and b) the GraphQLArgument annotation has no notion of "!"/optional argument or not, meaning that request generation can effectively never leave out any arguments.
An example is an electricity consumption API where parameters first or last is used to get the first or last N entries from a series of consumption values. The API returns nothing on the following conditions:
consumption(resolution: HOURLY, first: null, last: 100)
orconsumption(resolution: HOURLY, first: 100, last: null)
The query must be either of:consumption(resolution: HOURLY, last: 100)
orconsumption(resolution: HOURLY, first: 100)