GraphQL filtering with a period in the name returns an empty resultset #8071

Closed
opened 2025-12-29 20:31:57 +01:00 by adam · 2 comments
Owner

Originally created by @derdeagle on GitHub (May 16, 2023).

NetBox version

v3.5.1

Python version

3.10

Steps to Reproduce

  1. create device with name "gqltest.example.com"
  2. create interface on this device with the tags "bla_interface" and "interface.bla"
  3. add IP a random address (for verification purposes) to this interface
  4. query via GraphQL as follows (one working and one non-working example.

working

{
  device_list(name: "gqltest.example.com") {
    interfaces(tag: "bla_interface") {
      name
      tags {
        id
        name
      }
      ip_addresses {
        address
      }
    }
  }
}

non-working

{
  device_list(name: "gqltest.example.com") {
    interfaces(tag: "interface.bla") {
      name
      tags {
        id
        name
      }
      ip_addresses {
        address
      }
    }
  }
}

Expected Behavior

I expect the same result for both queries as they query for the very same interface.

Observed Behavior

working result

{
  "data": {
    "device_list": [
      {
        "interfaces": [
          {
            "name": "eth0",
            "tags": [
              {
                "id": "9",
                "name": "bla_interface"
              },
              {
                "id": "7",
                "name": "interface.bla"
              }
            ],
            "ip_addresses": [
              {
                "address": "1.2.3.4/24"
              }
            ]
          }
        ]
      }
    ]
  }
}

non-working result

{
  "data": {
    "device_list": [
      {
        "interfaces": []
      }
    ]
  }
}
Originally created by @derdeagle on GitHub (May 16, 2023). ### NetBox version v3.5.1 ### Python version 3.10 ### Steps to Reproduce 1. create device with name "gqltest.example.com" 2. create interface on this device with the tags "bla_interface" and "interface.bla" 3. add IP a random address (for verification purposes) to this interface 4. query via GraphQL as follows (one working and one non-working example. **working** ``` { device_list(name: "gqltest.example.com") { interfaces(tag: "bla_interface") { name tags { id name } ip_addresses { address } } } } ``` **non-working** ``` { device_list(name: "gqltest.example.com") { interfaces(tag: "interface.bla") { name tags { id name } ip_addresses { address } } } } ``` ### Expected Behavior I expect the same result for both queries as they query for the very same interface. ### Observed Behavior **working result** ``` { "data": { "device_list": [ { "interfaces": [ { "name": "eth0", "tags": [ { "id": "9", "name": "bla_interface" }, { "id": "7", "name": "interface.bla" } ], "ip_addresses": [ { "address": "1.2.3.4/24" } ] } ] } ] } } ``` **non-working result** ``` { "data": { "device_list": [ { "interfaces": [] } ] } } ```
adam closed this issue 2025-12-29 20:31:58 +01:00
Author
Owner

@kkthxbye-code commented on GitHub (May 16, 2023):

Tags are referenced by slugs. Slugs can't contain dots, so you actual tag slug is interface-bla. I'll close this as I'm unable to replicate it and it seems to just be a misunderstanding of how tag filtering functions.

If you are able to provide other replication steps, feel free to reply in this issue and I'll reopen.

@kkthxbye-code commented on GitHub (May 16, 2023): Tags are referenced by slugs. Slugs can't contain dots, so you actual tag slug is interface-bla. I'll close this as I'm unable to replicate it and it seems to just be a misunderstanding of how tag filtering functions. If you are able to provide other replication steps, feel free to reply in this issue and I'll reopen.
Author
Owner

@derdeagle commented on GitHub (May 16, 2023):

@kkthxbye-code Thank you for your information. You are right, it works with the slug. Unfortunately I didn't find this in the documentation and it working with the underscore was pure luck I guess.

@derdeagle commented on GitHub (May 16, 2023): @kkthxbye-code Thank you for your information. You are right, it works with the slug. Unfortunately I didn't find this in the documentation and it working with the underscore was pure luck I guess.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#8071