Skip to content

Avoid need for wrapper around single argument GraphQL input types with Querydsl and Query By Example #216

Closed

Description

@rstoyanchev

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.

Activity

  1. modified the milestones: 1.0.0-M4, 1.0.0-M5 on Dec 9, 2021
  2. modified the milestones: 1.0.0-M5, on Jan 6, 2022
  3. modified the milestones: , 1.2.0-M1 on Jan 12, 2023
  4. 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[/+] on Jan 12, 2023
  5. rstoyanchev commented on Jan 12, 2023

    @rstoyanchev
    ContributorAuthor

    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.

  6. self-assigned this
    on Mar 23, 2023
  7. added a commit that references this issue on Feb 13, 2024
    911b782
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: dataIssues related to working with datatype: enhancementA general enhancement

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    ⌂ 换网址