Skip to content

Conversation

@bctiemann
Copy link
Contributor

@bctiemann bctiemann commented Oct 24, 2025

Closes: #19338

Converts all id fields and all enum-based fields to FilterLookups, which support in_list and exact querying.

  • Changes BaseObjectTypeFilterMixin and ChangeLogFilterMixin (which are used by most if not all field types) to define id using a FilterLookup instead of UNSET.
  • In all apps' filters.py, all fields defined as a choice of enum values has similarly been redefined using a FilterLookup, with the same new lookup support.

Note: The linter really does not like this kind of typing syntax, but I wasn't able to find a better way to do it:

    authentication_algorithm: (
        FilterLookup[Annotated['AuthenticationAlgorithmEnum', strawberry.lazy('vpn.graphql.enums')]] | None
    ) = (
        strawberry_django.filter_field()
    )

Note: Depends on #20667

@bctiemann bctiemann changed the base branch from main to feature October 24, 2025 18:38
@bctiemann bctiemann changed the title 19338 graphql in list after v1 namespace refactor #19338 - Add in_list and exact support on all id and enum fields in GraphQL v2 Oct 24, 2025
@bctiemann bctiemann changed the title #19338 - Add in_list and exact support on all id and enum fields in GraphQL v2 Closes #19338 - Add in_list and exact support on all id and enum fields in GraphQL v2 Oct 24, 2025
@pheus
Copy link
Contributor

pheus commented Oct 24, 2025

Not a maintainer or reviewer - just dropping a quick thought. Thanks for the PR!

From my understanding, FilterLookup is mostly aimed at string fields and exposes string‑specific operators (e.g., contains, icontains, startswith, endswith). If the goal here is to limit the available filters for this field, would BaseFilterLookup be a better fit so we only surface the more generic lookups (like exact, in, isnull) and avoid string‑specific ones that may not apply?

If I’m off base or there’s a use case for the string lookups here, please feel free to ignore. Appreciate the work on this!

@bctiemann
Copy link
Contributor Author

@pheus You could be right; I only grabbed FilterLookup because it seemed more the recommended route (in more generic use cases than this one). Thanks for the pointer!

@jeremystretch
Copy link
Member

Marking this as blocked by #20679 temporarily

@jeremystretch jeremystretch added the status: blocked Another issue or external requirement is preventing implementation label Oct 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: blocked Another issue or external requirement is preventing implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add "in_list" operator to GraphQL API filters for IDs and Enums

3 participants