Skip to content

Missing LookupFilters for many fields in GraphQL API #16261

@cybarox

Description

@cybarox

Deployment Type

Self-hosted

NetBox Version

v4.0.3

Python Version

3.10

Steps to Reproduce

Set description on a device to "akron"

Use integrated GraphQL Explorer and use following query

{
  # query field with LookupFilter
  QUERY1: device_list(filters: {description: {i_contains: "akron"}}) {
    name
  }
  # query field with missing LookupFilter
  QUERY2: device_list(filters: {name: {i_contains: "akron"}}) {
    name
  }
}

For some fields the LookupFilters are available e.g. description for the device object.

With the change to strawberry-django, many fields are missing the LookupFilter functions e.g. name field of device object.

Expected Behavior

Get correct result:

{
  "data": {
    "QUERY1": [
      {
        "name": "dmi01-akron-pdu01"
      }
    ],
    "QUERY2": [
      {
        "name": "dmi01-akron-pdu01"
      },
      {
        "name": "dmi01-akron-rtr01"
      },
      {
        "name": "dmi01-akron-sw01"
      }
    ]
  }
}

Observed Behavior

Get Error due to missing LookupFilter:

{
  "data": null,
  "errors": [
    {
      "message": "String cannot represent a non string value: {i_contains: \"akron\"}",
      "locations": [
        {
          "line": 5,
          "column": 39
        }
      ]
    }
  ]
}

Metadata

Metadata

Assignees

Labels

severity: mediumResults in substantial degraded or broken functionality for specfic workflowsstatus: acceptedThis issue has been accepted for implementationtopic: GraphQLtype: bugA confirmed report of unexpected behavior in the application

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions