[GraphQL] service_list filter always requires port #10225

Closed
opened 2025-12-29 21:28:36 +01:00 by adam · 2 comments
Owner

Originally created by @4xoc on GitHub (Sep 11, 2024).

Originally assigned to: @arthanson on GitHub.

Deployment Type

Self-hosted

NetBox Version

v4.1.0

Python Version

3.10

Steps to Reproduce

  1. have a service
  2. try to query said service by name using GraphQL
{
  service_list(filters: {name: {starts_with: "SSH"}}) {
    id
  }
}

I'm using the latest docker-compose version of Netbox, nothing inside the containers has been changed.

Expected Behavior

A list of matching services should be the result and no error being reported back.

Observed Behavior

GraphQL reports that port is a required field that prevents searching for services by name only.

{
  "data": null,
  "errors": [
    {
      "message": "Field 'ServiceFilter.port' of required type 'Int!' was not provided.",
      "locations": [
        {
          "line": 2,
          "column": 25
        }
      ]
    }
  ]
}

Using 0 as port value causes a different error (not really related but maybe good to know):

{
  "data": null,
  "errors": [
    {
      "message": "cannot cast type integer to integer[]\nLINE 1: ... \"ipam_service\" WHERE (\"ipam_service\".\"ports\" @> 0::integer[...\n                                                             ^",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "service_list"
      ]
    }
  ]
}
Originally created by @4xoc on GitHub (Sep 11, 2024). Originally assigned to: @arthanson on GitHub. ### Deployment Type Self-hosted ### NetBox Version v4.1.0 ### Python Version 3.10 ### Steps to Reproduce 2. have a service 3. try to query said service by name using GraphQL ``` { service_list(filters: {name: {starts_with: "SSH"}}) { id } } ``` I'm using the latest docker-compose version of Netbox, nothing inside the containers has been changed. ### Expected Behavior A list of matching services should be the result and no error being reported back. ### Observed Behavior GraphQL reports that `port` is a required field that prevents searching for services by name only. ``` { "data": null, "errors": [ { "message": "Field 'ServiceFilter.port' of required type 'Int!' was not provided.", "locations": [ { "line": 2, "column": 25 } ] } ] } ``` Using `0` as port value causes a different error (not really related but maybe good to know): ``` { "data": null, "errors": [ { "message": "cannot cast type integer to integer[]\nLINE 1: ... \"ipam_service\" WHERE (\"ipam_service\".\"ports\" @> 0::integer[...\n ^", "locations": [ { "line": 2, "column": 3 } ], "path": [ "service_list" ] } ] } ```
adam added the type: bugstatus: acceptedseverity: low labels 2025-12-29 21:28:36 +01:00
adam closed this issue 2025-12-29 21:28:37 +01:00
Author
Owner

@arthanson commented on GitHub (Sep 11, 2024):

Looks like any Filter of type NumericArrayFilter is being marked as required.

@arthanson commented on GitHub (Sep 11, 2024): Looks like any Filter of type NumericArrayFilter is being marked as required.
Author
Owner

@4xoc commented on GitHub (Sep 12, 2024):

I've got to say, thanks a lot for such a speedy response and resolution of this issue!

@4xoc commented on GitHub (Sep 12, 2024): I've got to say, thanks a lot for such a speedy response and resolution of this issue!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#10225