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
Currently, QueryByExampleDataFetcher creates the example Object from the full arguments map. For queries with a single argument that is a GraphQL input type, this means the example object isn't the direct equivalent of the GraphQL input type, but rather a wrapper around it with the GraphQL input type as its only field.
We can improve this by detecting that a query has a single argument that is a GraphQL input type, and have the QueryByExampleDataFetcher use that argument as its source rather than the full arguments map.
The same applies to QuerydslDataFetcher, which builds a predicate relative to the full map, but for such single argument queries, it might make more sense to nest and be relative to that argument.
The text was updated successfully, but these errors were encountered:
rstoyanchev
changed the title
Improve Query By Example and Querydsl support for single argument queries with GraphQL input type
Avoid need for wrapper around single argument GraphQL input types with Querydsl and Query By Example
Jan 12, 2023
It looks like we may be able to look this up at runtime via getFieldDefinition().getArguments() on DataFetchingEnvironment, which would work transparently for both auto-registered and manually registered DataFetcher repositories.
If that doesn't work, we could try getFieldDefinition().getInputValueDefinitions() on FieldWiringEnvironment from the WiringFactory in AutoRegistrationRuntimeWiringConfigurer, but that would only cover auto-registrations. For manually registered ones, one would have to provide the argument name.
Currently,
QueryByExampleDataFetcher
creates the example Object from the full arguments map. For queries with a single argument that is a GraphQL input type, this means the example object isn't the direct equivalent of the GraphQL input type, but rather a wrapper around it with the GraphQL input type as its only field.We can improve this by detecting that a query has a single argument that is a GraphQL input type, and have the
QueryByExampleDataFetcher
use that argument as its source rather than the full arguments map.The same applies to
QuerydslDataFetcher
, which builds a predicate relative to the full map, but for such single argument queries, it might make more sense to nest and be relative to that argument.The text was updated successfully, but these errors were encountered: