[PR #18701] [MERGED] Closes #7598: Enable custom field filtering for GraphQL #15419

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

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/18701
Author: @jeremystretch
Created: 2/21/2025
Status: Merged
Merged: 3/7/2025
Merged by: @arthanson

Base: featureHead: 7598-graphql-custom-fields


📝 Commits (10+)

  • cca556c Closes #7598: GraphQL Filter Redesign
  • ddbda68 Update netbox/netbox/tests/test_graphql.py
  • 2482c18 cleanup enums, enable strawberry-django optimizer, extra line
  • 02942fa removing commented enum
  • f1d7ad8 moving filter_lookups.py to netbox/graphql
  • 36dc8cd Generate Strawberry filter enums from ChoiceSets (#18676)
  • 186be5f Update GraphQL filter documentation
  • 5fcf32c Apply tenant filters consistently
  • 380c9c1 Introduce ScopedFilterMixin
  • c369ac9 Misc cleanup

📊 Changes

47 files changed (+3042 additions, -682 deletions)

View changed files

📝 docs/development/adding-models.md (+5 -3)
📝 docs/integrations/graphql-api.md (+34 -5)
📝 docs/plugins/development/filtersets.md (+1 -1)
netbox/circuits/graphql/enums.py (+20 -0)
netbox/circuits/graphql/filter_mixins.py (+19 -0)
📝 netbox/circuits/graphql/filters.py (+149 -32)
📝 netbox/circuits/graphql/types.py (+9 -5)
netbox/core/graphql/filter_mixins.py (+36 -0)
📝 netbox/core/graphql/filters.py (+70 -9)
📝 netbox/core/graphql/mixins.py (+4 -1)
📝 netbox/core/graphql/types.py (+7 -0)
netbox/dcim/graphql/enums.py (+77 -0)
netbox/dcim/graphql/filter_mixins.py (+149 -0)
📝 netbox/dcim/graphql/filters.py (+674 -130)
📝 netbox/dcim/graphql/types.py (+37 -18)
netbox/extras/graphql/enums.py (+26 -0)
netbox/extras/graphql/filter_mixins.py (+52 -0)
📝 netbox/extras/graphql/filters.py (+245 -41)
📝 netbox/extras/graphql/types.py (+18 -3)
netbox/ipam/graphql/enums.py (+27 -0)

...and 27 more files

📄 Description

Closes: #7598

This PR serves to capture @jeremypng's recent work on improving the GraphQL API. Although this work primarily targets FR #7598, it includes many foundational improvements:

  • Discontinuing the use of deprecated filters (USE_DEPRECATED_FILTERS = False)
  • Defining standalone filters for GraphQL
  • Reusable mixin classes for filters
  • Adds the as_enum() method to ChoiceSet for use in GraphQL filters

🔄 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/18701 **Author:** [@jeremystretch](https://github.com/jeremystretch) **Created:** 2/21/2025 **Status:** ✅ Merged **Merged:** 3/7/2025 **Merged by:** [@arthanson](https://github.com/arthanson) **Base:** `feature` ← **Head:** `7598-graphql-custom-fields` --- ### 📝 Commits (10+) - [`cca556c`](https://github.com/netbox-community/netbox/commit/cca556c6f95f65b7d61624c91461f09f8d485b1d) Closes #7598: GraphQL Filter Redesign - [`ddbda68`](https://github.com/netbox-community/netbox/commit/ddbda68595a3ccbca68d8d0a48f038a170686fc5) Update netbox/netbox/tests/test_graphql.py - [`2482c18`](https://github.com/netbox-community/netbox/commit/2482c18d27ea4349224024b1b07594c278b7935b) cleanup enums, enable strawberry-django optimizer, extra line - [`02942fa`](https://github.com/netbox-community/netbox/commit/02942faa267784b459c684f1aeb90aebf99f3076) removing commented enum - [`f1d7ad8`](https://github.com/netbox-community/netbox/commit/f1d7ad82dc9165c8c4e2b1944123ea411a8671a1) moving filter_lookups.py to netbox/graphql - [`36dc8cd`](https://github.com/netbox-community/netbox/commit/36dc8cd0d91736b9c3da19c37a138b7216d08ef7) Generate Strawberry filter enums from ChoiceSets (#18676) - [`186be5f`](https://github.com/netbox-community/netbox/commit/186be5f5d67d6bce0f669fcce6ec4d4e209bf272) Update GraphQL filter documentation - [`5fcf32c`](https://github.com/netbox-community/netbox/commit/5fcf32cc9e8208f384185c6ac1df59788cffdcbc) Apply tenant filters consistently - [`380c9c1`](https://github.com/netbox-community/netbox/commit/380c9c10417821e0b92abf5cf1845e8f7ae72c0b) Introduce ScopedFilterMixin - [`c369ac9`](https://github.com/netbox-community/netbox/commit/c369ac929d15d787790e07120335d7df9cc840e1) Misc cleanup ### 📊 Changes **47 files changed** (+3042 additions, -682 deletions) <details> <summary>View changed files</summary> 📝 `docs/development/adding-models.md` (+5 -3) 📝 `docs/integrations/graphql-api.md` (+34 -5) 📝 `docs/plugins/development/filtersets.md` (+1 -1) ➕ `netbox/circuits/graphql/enums.py` (+20 -0) ➕ `netbox/circuits/graphql/filter_mixins.py` (+19 -0) 📝 `netbox/circuits/graphql/filters.py` (+149 -32) 📝 `netbox/circuits/graphql/types.py` (+9 -5) ➕ `netbox/core/graphql/filter_mixins.py` (+36 -0) 📝 `netbox/core/graphql/filters.py` (+70 -9) 📝 `netbox/core/graphql/mixins.py` (+4 -1) 📝 `netbox/core/graphql/types.py` (+7 -0) ➕ `netbox/dcim/graphql/enums.py` (+77 -0) ➕ `netbox/dcim/graphql/filter_mixins.py` (+149 -0) 📝 `netbox/dcim/graphql/filters.py` (+674 -130) 📝 `netbox/dcim/graphql/types.py` (+37 -18) ➕ `netbox/extras/graphql/enums.py` (+26 -0) ➕ `netbox/extras/graphql/filter_mixins.py` (+52 -0) 📝 `netbox/extras/graphql/filters.py` (+245 -41) 📝 `netbox/extras/graphql/types.py` (+18 -3) ➕ `netbox/ipam/graphql/enums.py` (+27 -0) _...and 27 more files_ </details> ### 📄 Description ### Closes: #7598 This PR serves to capture @jeremypng's recent work on improving the GraphQL API. Although this work primarily targets FR #7598, it includes many foundational improvements: - Discontinuing the use of deprecated filters (`USE_DEPRECATED_FILTERS = False`) - Defining standalone filters for GraphQL - Reusable mixin classes for filters - Adds the `as_enum()` method to ChoiceSet for use in GraphQL filters --- <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:21:49 +01:00
adam closed this issue 2025-12-30 00:21:49 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#15419