Skip to content

Conversation

williamjallen
Copy link
Collaborator

Developers currently need to manually specify input types in our GraphQL schema file, requiring field names and column mappings to be duplicated. While it's merely a nuisance at the moment, this approach will be completely inadequate once we introduce the ability to filter by relationship existence. This PR cleans up the developer experience by automatically generating filter input types and guessing the input type needed for a filter directive in most cases. That means all developers need to do is add @filterable and @filter directives to fields and everything just works. Pretty neat!

An additional benefit of autogenerating everything is that validation can be added automatically as well. That means that users will now see a validation error when trying to create an invalid filter like this:

filters: {
    eq: {
        id: "123",
        name: "foo",
    },
}

This validation improvement resolves the issues remaining after #2860.

It isn't really practical to fix these PHPStan errors unfortunately.
@williamjallen williamjallen force-pushed the automatic-filter-inputs branch from d1e6439 to 77c410f Compare May 3, 2025 12:50
Copy link
Member

@josephsnyder josephsnyder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! The indicated kind of filter validation is properly reported as failed.

@josephsnyder josephsnyder added this pull request to the merge queue May 5, 2025
Merged via the queue into Kitware:master with commit 79f04c0 May 5, 2025
13 of 14 checks passed
@williamjallen williamjallen deleted the automatic-filter-inputs branch May 5, 2025 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants