[PR #20680] [CLOSED] Closes #19338 - Add in_list and exact support on all id and enum fields in GraphQL v2 #16010

Closed
opened 2025-12-30 00:25:18 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/20680
Author: @bctiemann
Created: 10/24/2025
Status: Closed

Base: featureHead: 19338-graphql-in_list-after-v1-namespace-refactor


📝 Commits (10+)

  • 5fdbc0f Clone all GraphQL objects to V1 versions
  • a408488 Convert all id fields and enum fields to FilterLookups (with in_list and exact support)
  • 5a3eb10 Change usages of FilterLookup to BaseFilterLookup
  • 0b3055a Merge branch 'feature' into 19338-graphql-in_list-after-v1-namespace-refactor
  • 2f6494c Merge feature
  • 8215666 Merge branch 'feature' into 19338-graphql-in_list
  • b8fea8c Merge feature
  • 1d6d154 Set GRAPHQL_DEFAULT_VERSION = 2 in testing environment
  • b62f735 Integrate Owner and JournalEntries fields
  • a00b4cd Incorporate Owner fields/types into V1 classes

📊 Changes

58 files changed (+6729 additions, -122 deletions)

View changed files

netbox/circuits/graphql/filter_mixins_v1.py (+19 -0)
📝 netbox/circuits/graphql/filters.py (+12 -6)
netbox/circuits/graphql/filters_v1.py (+228 -0)
netbox/circuits/graphql/schema_v1.py (+42 -0)
netbox/circuits/graphql/types_v1.py (+191 -0)
📝 netbox/core/graphql/filter_mixins.py (+3 -3)
netbox/core/graphql/filter_mixins_v1.py (+36 -0)
netbox/core/graphql/filters_v1.py (+89 -0)
netbox/core/graphql/mixins_v1.py (+35 -0)
netbox/core/graphql/schema_v1.py (+15 -0)
netbox/core/graphql/types_v1.py (+55 -0)
netbox/dcim/graphql/filter_mixins_v1.py (+155 -0)
📝 netbox/dcim/graphql/filters.py (+97 -59)
netbox/dcim/graphql/filters_v1.py (+1020 -0)
netbox/dcim/graphql/gfk_mixins_v1.py (+137 -0)
netbox/dcim/graphql/mixins_v1.py (+43 -0)
netbox/dcim/graphql/schema_v1.py (+138 -0)
netbox/dcim/graphql/types_v1.py (+903 -0)
netbox/extras/graphql/filter_mixins_v1.py (+52 -0)
📝 netbox/extras/graphql/filters.py (+25 -11)

...and 38 more files

📄 Description

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


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/20680 **Author:** [@bctiemann](https://github.com/bctiemann) **Created:** 10/24/2025 **Status:** ❌ Closed **Base:** `feature` ← **Head:** `19338-graphql-in_list-after-v1-namespace-refactor` --- ### 📝 Commits (10+) - [`5fdbc0f`](https://github.com/netbox-community/netbox/commit/5fdbc0f9f5d7298f2a27384fb6b1483ad123a55c) Clone all GraphQL objects to V1 versions - [`a408488`](https://github.com/netbox-community/netbox/commit/a4084884d3a20aa983fb7e606460c76c4055ebd0) Convert all id fields and enum fields to FilterLookups (with in_list and exact support) - [`5a3eb10`](https://github.com/netbox-community/netbox/commit/5a3eb1053fd35ad59ee99cc9e2094cbd928a982a) Change usages of FilterLookup to BaseFilterLookup - [`0b3055a`](https://github.com/netbox-community/netbox/commit/0b3055ab83f54353187dc0ada1a135d1db56d743) Merge branch 'feature' into 19338-graphql-in_list-after-v1-namespace-refactor - [`2f6494c`](https://github.com/netbox-community/netbox/commit/2f6494cd936999f326341fe116df4f13a36e31e9) Merge feature - [`8215666`](https://github.com/netbox-community/netbox/commit/82156660f755dec664c43ffc62ed887f00d4ec45) Merge branch 'feature' into 19338-graphql-in_list - [`b8fea8c`](https://github.com/netbox-community/netbox/commit/b8fea8c8df125dd19f960637130b463ea07a7f7d) Merge feature - [`1d6d154`](https://github.com/netbox-community/netbox/commit/1d6d154919eb1c6c1551e7a48b4dc09c17830317) Set GRAPHQL_DEFAULT_VERSION = 2 in testing environment - [`b62f735`](https://github.com/netbox-community/netbox/commit/b62f735f6063334b8ebf4d1ff12daf808244fca3) Integrate Owner and JournalEntries fields - [`a00b4cd`](https://github.com/netbox-community/netbox/commit/a00b4cd03caa5912a549e15dc48c137fc55b1b54) Incorporate Owner fields/types into V1 classes ### 📊 Changes **58 files changed** (+6729 additions, -122 deletions) <details> <summary>View changed files</summary> ➕ `netbox/circuits/graphql/filter_mixins_v1.py` (+19 -0) 📝 `netbox/circuits/graphql/filters.py` (+12 -6) ➕ `netbox/circuits/graphql/filters_v1.py` (+228 -0) ➕ `netbox/circuits/graphql/schema_v1.py` (+42 -0) ➕ `netbox/circuits/graphql/types_v1.py` (+191 -0) 📝 `netbox/core/graphql/filter_mixins.py` (+3 -3) ➕ `netbox/core/graphql/filter_mixins_v1.py` (+36 -0) ➕ `netbox/core/graphql/filters_v1.py` (+89 -0) ➕ `netbox/core/graphql/mixins_v1.py` (+35 -0) ➕ `netbox/core/graphql/schema_v1.py` (+15 -0) ➕ `netbox/core/graphql/types_v1.py` (+55 -0) ➕ `netbox/dcim/graphql/filter_mixins_v1.py` (+155 -0) 📝 `netbox/dcim/graphql/filters.py` (+97 -59) ➕ `netbox/dcim/graphql/filters_v1.py` (+1020 -0) ➕ `netbox/dcim/graphql/gfk_mixins_v1.py` (+137 -0) ➕ `netbox/dcim/graphql/mixins_v1.py` (+43 -0) ➕ `netbox/dcim/graphql/schema_v1.py` (+138 -0) ➕ `netbox/dcim/graphql/types_v1.py` (+903 -0) ➕ `netbox/extras/graphql/filter_mixins_v1.py` (+52 -0) 📝 `netbox/extras/graphql/filters.py` (+25 -11) _...and 38 more files_ </details> ### 📄 Description ### 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 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-30 00:25:18 +01:00
adam closed this issue 2025-12-30 00:25:18 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#16010