GraphQL ConfigContextFilter requires fields in filter #11550

Closed
opened 2025-12-29 21:46:40 +01:00 by adam · 0 comments
Owner

Originally created by @tyler-8 on GitHub (Aug 31, 2025).

Originally assigned to: @jnovinger on GitHub.

Deployment Type

Self-hosted

NetBox Version

v4.3.7

Python Version

3.12

Steps to Reproduce

  1. Create a site with any name (ie: Atlanta)
  2. Create a config context with any data and assign it to the site from step 1.
  3. Make a GraphQL API call with this query:
query contextList {
  config_context_list(filters: {sites:{name:{in_list:["Atlanta"]}}}) {
    name
    data
  }
}

Expected Behavior

The query returns the configuration context matching the site assignments in the filter.

Observed Behavior

The GraphQL API returns the following output:

{
  "data": null,
  "errors": [
    {
      "message": "Field 'ConfigContextFilter.name' of required type 'StrFilterLookup!' was not provided.",
      "locations": [
        {
          "line": 2,
          "column": 32
        }
      ]
    },
    {
      "message": "Field 'ConfigContextFilter.description' of required type 'StrFilterLookup!' was not provided.",
      "locations": [
        {
          "line": 2,
          "column": 32
        }
      ]
    },
    {
      "message": "Field 'ConfigContextFilter.is_active' of required type 'BoolFilterLookup!' was not provided.",
      "locations": [
        {
          "line": 2,
          "column": 32
        }
      ]
    }
  ]
}

The issue stems from extras/graphql/filters.py and the three fields name, is_active, description not having a union operator with None.

name: FilterLookup[str] = strawberry_django.filter_field()
description: FilterLookup[str] = strawberry_django.filter_field()
is_active: FilterLookup[bool] = strawberry_django.filter_field()
Originally created by @tyler-8 on GitHub (Aug 31, 2025). Originally assigned to: @jnovinger on GitHub. ### Deployment Type Self-hosted ### NetBox Version v4.3.7 ### Python Version 3.12 ### Steps to Reproduce 1. Create a site with any name (ie: Atlanta) 2. Create a config context with any data and assign it to the site from step 1. 3. Make a GraphQL API call with this query: ```graphql query contextList { config_context_list(filters: {sites:{name:{in_list:["Atlanta"]}}}) { name data } } ``` ### Expected Behavior The query returns the configuration context matching the site assignments in the filter. ### Observed Behavior The GraphQL API returns the following output: ```json { "data": null, "errors": [ { "message": "Field 'ConfigContextFilter.name' of required type 'StrFilterLookup!' was not provided.", "locations": [ { "line": 2, "column": 32 } ] }, { "message": "Field 'ConfigContextFilter.description' of required type 'StrFilterLookup!' was not provided.", "locations": [ { "line": 2, "column": 32 } ] }, { "message": "Field 'ConfigContextFilter.is_active' of required type 'BoolFilterLookup!' was not provided.", "locations": [ { "line": 2, "column": 32 } ] } ] } ``` The issue stems from [extras/graphql/filters.py](https://github.com/netbox-community/netbox/blob/08ae1391618dad69866717681e79a56ad9414f80/netbox/extras/graphql/filters.py#L44) and the three fields `name, is_active, description` not having a union operator with `None`. ```python name: FilterLookup[str] = strawberry_django.filter_field() description: FilterLookup[str] = strawberry_django.filter_field() is_active: FilterLookup[bool] = strawberry_django.filter_field() ```
adam added the type: bugstatus: acceptedseverity: low labels 2025-12-29 21:46:40 +01:00
adam closed this issue 2025-12-29 21:46:40 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#11550