Closes #19338 - Add in_list and exact support on all id and enum fields in GraphQL v2 #978

Closed
opened 2026-04-05 19:25:34 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @bctiemann on 10/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 https://github.com/netbox-community/netbox/pull/20667

*Originally created by @bctiemann on 10/24/2025* ### Closes: #19338 Converts all `id` fields and all enum-based fields to `FilterLookup`s, 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 https://github.com/netbox-community/netbox/pull/20667
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/netbox#978