[PR #20829] [MERGED] Closes: #19338 - GraphQL: Adds in_list lookups for id and enum fields #16056

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

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/20829
Author: @bctiemann
Created: 11/19/2025
Status: Merged
Merged: 11/25/2025
Merged by: @bctiemann

Base: featureHead: 19338-graphql-in_list-on-feature


📝 Commits (10+)

  • 867a01f Clone all GraphQL objects to V1 versions
  • a718cb1 Convert all id fields and enum fields to FilterLookups (with in_list and exact support)
  • c7d94bd Change usages of FilterLookup to BaseFilterLookup
  • d192c1e Merge feature
  • 3e1ccc8 Set GRAPHQL_DEFAULT_VERSION = 2 in testing environment
  • ebeceaa Integrate Owner and JournalEntries fields
  • db3a4bc Incorporate Owner fields/types into V1 classes
  • 47ac506 Add a test to validate versioned GraphQL types
  • 5585b41 Remove all V1 files
  • 38b2839 Remove version-specific unit tests

📊 Changes

20 files changed (+287 additions, -197 deletions)

View changed files

📝 netbox/circuits/graphql/filters.py (+12 -6)
netbox/core/graphql/enums.py (+11 -0)
📝 netbox/core/graphql/filter_mixins.py (+4 -3)
📝 netbox/core/graphql/filters.py (+11 -6)
📝 netbox/dcim/graphql/enums.py (+4 -0)
📝 netbox/dcim/graphql/filter_mixins.py (+14 -7)
📝 netbox/dcim/graphql/filters.py (+103 -59)
📝 netbox/extras/graphql/filters.py (+25 -11)
📝 netbox/ipam/graphql/filters.py (+11 -9)
📝 netbox/netbox/graphql/filter_mixins.py (+3 -3)
📝 netbox/netbox/graphql/schema.py (+3 -44)
netbox/netbox/graphql/utils.py (+0 -16)
📝 netbox/netbox/tests/test_graphql.py (+17 -3)
📝 netbox/netbox/urls.py (+3 -6)
📝 netbox/tenancy/graphql/filters.py (+2 -2)
📝 netbox/virtualization/graphql/enums.py (+2 -0)
📝 netbox/virtualization/graphql/filters.py (+10 -3)
📝 netbox/vpn/graphql/enums.py (+2 -0)
📝 netbox/vpn/graphql/filters.py (+47 -16)
📝 netbox/wireless/graphql/filters.py (+3 -3)

📄 Description

Closes: #19338

Breaking change. Adds exact: and in_list: and is_null: semantics to GraphQL queries for id fields and enum field types, which also means that bare values are no longer supported.

This means the following queries are valid:

{
    location_list( filters: {
        status: {exact: STATUS_PLANNED},
        OR: {status: {exact: STATUS_STAGING}}
    }) {
        id site {id}
    }
}
{
    location_list( filters: {
        status: {in_list: [STATUS_PLANNED, STATUS_STAGING]}
    }) {
        id site {id}
    }
}

However the following (which worked previously) is not:

{
    location_list( filters: {
        status: STATUS_PLANNED,
        OR: {status: STATUS_STAGING}
    }) {
        id site {id}
    }
}

🔄 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/20829 **Author:** [@bctiemann](https://github.com/bctiemann) **Created:** 11/19/2025 **Status:** ✅ Merged **Merged:** 11/25/2025 **Merged by:** [@bctiemann](https://github.com/bctiemann) **Base:** `feature` ← **Head:** `19338-graphql-in_list-on-feature` --- ### 📝 Commits (10+) - [`867a01f`](https://github.com/netbox-community/netbox/commit/867a01fae5e431f9a0f893b8cfbb3fc70f089bb0) Clone all GraphQL objects to V1 versions - [`a718cb1`](https://github.com/netbox-community/netbox/commit/a718cb1173c5da5425f294c5d1a20882b0e1950c) Convert all id fields and enum fields to FilterLookups (with in_list and exact support) - [`c7d94bd`](https://github.com/netbox-community/netbox/commit/c7d94bd5291aba68299d191243bde3e77c1c28cc) Change usages of FilterLookup to BaseFilterLookup - [`d192c1e`](https://github.com/netbox-community/netbox/commit/d192c1e352deb9d28d053885bf0e4b2d2836b2aa) Merge feature - [`3e1ccc8`](https://github.com/netbox-community/netbox/commit/3e1ccc80e988b399a96aa9af5c48f8f15cf5cc85) Set GRAPHQL_DEFAULT_VERSION = 2 in testing environment - [`ebeceaa`](https://github.com/netbox-community/netbox/commit/ebeceaaa217dcd27031c91c51a902dbe36826e27) Integrate Owner and JournalEntries fields - [`db3a4bc`](https://github.com/netbox-community/netbox/commit/db3a4bc731e2dd1721c388be390ef8670c436fd8) Incorporate Owner fields/types into V1 classes - [`47ac506`](https://github.com/netbox-community/netbox/commit/47ac506d5cb9db3605e814f4534e27ace58ab6ee) Add a test to validate versioned GraphQL types - [`5585b41`](https://github.com/netbox-community/netbox/commit/5585b410f810a1cd5553a094901569a82f9cbd25) Remove all V1 files - [`38b2839`](https://github.com/netbox-community/netbox/commit/38b2839a1e185d7fbdba66ae9d5bf69c8235ee36) Remove version-specific unit tests ### 📊 Changes **20 files changed** (+287 additions, -197 deletions) <details> <summary>View changed files</summary> 📝 `netbox/circuits/graphql/filters.py` (+12 -6) ➕ `netbox/core/graphql/enums.py` (+11 -0) 📝 `netbox/core/graphql/filter_mixins.py` (+4 -3) 📝 `netbox/core/graphql/filters.py` (+11 -6) 📝 `netbox/dcim/graphql/enums.py` (+4 -0) 📝 `netbox/dcim/graphql/filter_mixins.py` (+14 -7) 📝 `netbox/dcim/graphql/filters.py` (+103 -59) 📝 `netbox/extras/graphql/filters.py` (+25 -11) 📝 `netbox/ipam/graphql/filters.py` (+11 -9) 📝 `netbox/netbox/graphql/filter_mixins.py` (+3 -3) 📝 `netbox/netbox/graphql/schema.py` (+3 -44) ➖ `netbox/netbox/graphql/utils.py` (+0 -16) 📝 `netbox/netbox/tests/test_graphql.py` (+17 -3) 📝 `netbox/netbox/urls.py` (+3 -6) 📝 `netbox/tenancy/graphql/filters.py` (+2 -2) 📝 `netbox/virtualization/graphql/enums.py` (+2 -0) 📝 `netbox/virtualization/graphql/filters.py` (+10 -3) 📝 `netbox/vpn/graphql/enums.py` (+2 -0) 📝 `netbox/vpn/graphql/filters.py` (+47 -16) 📝 `netbox/wireless/graphql/filters.py` (+3 -3) </details> ### 📄 Description ### Closes: #19338 **Breaking change.** Adds `exact:` and `in_list:` and `is_null:` semantics to GraphQL queries for `id` fields and enum field types, which also means that bare values are no longer supported. This means the following queries are valid: ``` { location_list( filters: { status: {exact: STATUS_PLANNED}, OR: {status: {exact: STATUS_STAGING}} }) { id site {id} } } ``` ``` { location_list( filters: { status: {in_list: [STATUS_PLANNED, STATUS_STAGING]} }) { id site {id} } } ``` However the following (which worked previously) is not: ``` { location_list( filters: { status: STATUS_PLANNED, OR: {status: STATUS_STAGING} }) { id site {id} } } ``` --- <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:34 +01:00
adam closed this issue 2025-12-30 00:25:34 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#16056