Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GraphQL query filtering capability #2212

Merged
merged 5 commits into from
May 20, 2024

Conversation

williamjallen
Copy link
Collaborator

This PR introduces the ability to add conditions to aggregate queries in the GraphQL API. This allows users to select only public projects or all the builds submitted after a given timestamp, for example. This introductory PR adds the =, !=, <, and > operators. Future PRs will add additional operators to the filter set.

How is this PR different from Lighthouse-PHP's existing filtering functionality? The approach Lighthouse takes is not type safe, which makes the API confusing to use and difficult to maintain. It also lacks the flexibility CDash needs, and does not support enumeration filtering. This PR builds upon Lighthouse's existing approach, by introducing type-safe filters.

In the future, these filters can be improved by restricting the operators available on a per-type basis. For example, it doesn't make sense to perform a less-than operation on an enumeration in most cases, but we still offer the less-than operator.

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.

Exploring the filtering GraphQL Explorer works great. Good filtering on exact string matching and integers (GT and LT)

@josephsnyder josephsnyder added this pull request to the merge queue May 17, 2024
@josephsnyder josephsnyder removed this pull request from the merge queue due to a manual request May 17, 2024
@zackgalbreath zackgalbreath added this pull request to the merge queue May 20, 2024
Merged via the queue into Kitware:master with commit 6f777b1 May 20, 2024
6 checks passed
@williamjallen williamjallen deleted the graphql-filters branch May 20, 2024 15:16
williamjallen added a commit to williamjallen/CDash that referenced this pull request May 22, 2024
This PR introduces the ability to add conditions to aggregate queries in
the GraphQL API. This allows users to select only public projects or all
the builds submitted after a given timestamp, for example. This
introductory PR adds the =, !=, <, and > operators. Future PRs will add
additional operators to the filter set.

How is this PR different from Lighthouse-PHP's
[existing](https://lighthouse-php.com/master/eloquent/complex-where-conditions.html)
filtering functionality? The approach Lighthouse takes is not type safe,
which makes the API confusing to use and difficult to maintain. It also
lacks the flexibility CDash needs, and does not support enumeration
filtering. This PR builds upon Lighthouse's existing approach, by
introducing type-safe filters.

In the future, these filters can be improved by restricting the
operators available on a per-type basis. For example, it doesn't make
sense to perform a less-than operation on an enumeration in most cases,
but we still offer the less-than operator.
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.

3 participants