GraphQL: NOT-Filter (here for tenants_list) not honored for group(_id) and results includes the filtered group #10546

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

Originally created by @dxks on GitHub (Dec 5, 2024).

Deployment Type

Self-hosted

Triage priority

N/A

NetBox Version

v4.1.7

Python Version

3.12

Steps to Reproduce

All verified on demo.netbox.dev (so assumption is that Tenant-Group Customers exists)

  1. Create a new Tenant-Group (i.e. Partners)
  2. Create a new Tenant and make it a member of Partners

Fire the folling graphql query:

query MyQuery {
  tenant_list(filters:{NOT:{group:"customers"}}) {
    id
    name
    group {
      id
      name
      slug
    }
  }
}

Expected Behavior

Getting a list of all Tenants that are not member of the group Customers:

{
  "data": {
    "tenant_list": [
      {
        "id": "15",
        "name": "NetBoxLabs",
        "group": {
          "id": "2",
          "name": "Partners",
          "slug": "partners"
        }
      }
    ]
  }
}

Observed Behavior

Getting a list of all Tenants that are member of the group Customers:

{
  "data": {
    "tenant_list": [
      {
        "id": "7",
        "name": "Cyberdyne Systems",
        "group": {
          "id": "1",
          "name": "Customers",
          "slug": "customers"
        }
      },
      {
        "id": "5",
        "name": "Dunder-Mifflin, Inc.",
        "group": {
          "id": "1",
          "name": "Customers",
          "slug": "customers"
        }
      },
      {
        "id": "1",
        "name": "Initech",
        "group": {
          "id": "1",
          "name": "Customers",
          "slug": "customers"
        }
      },
      {
        "id": "10",
        "name": "Jimbob's Banking & Trust",
        "group": {
          "id": "1",
          "name": "Customers",
          "slug": "customers"
        }
      },
      {
        "id": "13",
        "name": "NC State University",
        "group": {
          "id": "1",
          "name": "Customers",
          "slug": "customers"
        }
      },
      {
        "id": "9",
        "name": "Nakatomi Corportation",
        "group": {
          "id": "1",
          "name": "Customers",
          "slug": "customers"
        }
      },
      {
        "id": "3",
        "name": "Pied Piper",
        "group": {
          "id": "1",
          "name": "Customers",
          "slug": "customers"
        }
      },
      {
        "id": "4",
        "name": "Stark Industries",
        "group": {
          "id": "1",
          "name": "Customers",
          "slug": "customers"
        }
      },
      {
        "id": "2",
        "name": "Strickland Propane",
        "group": {
          "id": "1",
          "name": "Customers",
          "slug": "customers"
        }
      },
      {
        "id": "8",
        "name": "Umbrella Corporation",
        "group": {
          "id": "1",
          "name": "Customers",
          "slug": "customers"
        }
      },
      {
        "id": "6",
        "name": "Wayne Enterprises",
        "group": {
          "id": "1",
          "name": "Customers",
          "slug": "customers"
        }
      }
    ]
  }
}
Originally created by @dxks on GitHub (Dec 5, 2024). ### Deployment Type Self-hosted ### Triage priority N/A ### NetBox Version v4.1.7 ### Python Version 3.12 ### Steps to Reproduce All verified on demo.netbox.dev (so assumption is that Tenant-Group Customers exists) 1. Create a new Tenant-Group (i.e. Partners) 2. Create a new Tenant and make it a member of Partners Fire the folling graphql query: ``` query MyQuery { tenant_list(filters:{NOT:{group:"customers"}}) { id name group { id name slug } } } ``` ### Expected Behavior Getting a list of all Tenants that are not member of the group Customers: ``` { "data": { "tenant_list": [ { "id": "15", "name": "NetBoxLabs", "group": { "id": "2", "name": "Partners", "slug": "partners" } } ] } } ``` ### Observed Behavior Getting a list of all Tenants that are member of the group Customers: ``` { "data": { "tenant_list": [ { "id": "7", "name": "Cyberdyne Systems", "group": { "id": "1", "name": "Customers", "slug": "customers" } }, { "id": "5", "name": "Dunder-Mifflin, Inc.", "group": { "id": "1", "name": "Customers", "slug": "customers" } }, { "id": "1", "name": "Initech", "group": { "id": "1", "name": "Customers", "slug": "customers" } }, { "id": "10", "name": "Jimbob's Banking & Trust", "group": { "id": "1", "name": "Customers", "slug": "customers" } }, { "id": "13", "name": "NC State University", "group": { "id": "1", "name": "Customers", "slug": "customers" } }, { "id": "9", "name": "Nakatomi Corportation", "group": { "id": "1", "name": "Customers", "slug": "customers" } }, { "id": "3", "name": "Pied Piper", "group": { "id": "1", "name": "Customers", "slug": "customers" } }, { "id": "4", "name": "Stark Industries", "group": { "id": "1", "name": "Customers", "slug": "customers" } }, { "id": "2", "name": "Strickland Propane", "group": { "id": "1", "name": "Customers", "slug": "customers" } }, { "id": "8", "name": "Umbrella Corporation", "group": { "id": "1", "name": "Customers", "slug": "customers" } }, { "id": "6", "name": "Wayne Enterprises", "group": { "id": "1", "name": "Customers", "slug": "customers" } } ] } } ```
adam added the type: bugstatus: duplicatetopic: GraphQL labels 2025-12-29 21:32:59 +01:00
adam closed this issue 2025-12-29 21:32:59 +01:00
Author
Owner

@dxks commented on GitHub (Dec 5, 2024):

Looks like OR also not working:

query MyQuery {
  tenant_list(filters:{group:"customers", OR:{group:"partners"}}) {
    id
    name
    group {
      id
      name
      slug
    }
  }
}

brings an empty list:

{
  "data": {
    "tenant_list": []
  }
}

so only the last group value is used for filtering

@dxks commented on GitHub (Dec 5, 2024): Looks like OR also not working: ``` query MyQuery { tenant_list(filters:{group:"customers", OR:{group:"partners"}}) { id name group { id name slug } } } ``` brings an empty list: ``` { "data": { "tenant_list": [] } } ``` so only the last group value is used for filtering
Author
Owner

@arthanson commented on GitHub (Dec 5, 2024):

Closing as a dupe of #17688

@arthanson commented on GitHub (Dec 5, 2024): Closing as a dupe of #17688
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#10546