Skip to content

GraphQL alias filter affects all properties of the same type #18157

@TribuneX

Description

@TribuneX

Deployment Type

Self-hosted

Triage priority

N/A

NetBox Version

v4.1.7

Python Version

3.12

Steps to Reproduce

It seems, that I cannot use a single alias filter within a query, since it will also have an undesired effect on subsequent properties of the same type. The same applies if I use multiple aliases in the same query. The first one always wins.

See the following demo query done on the NetBox demo instance:

query aliasOnInterface {
  device(id: 1) {
    name
    lags: interfaces(filters: { type: { exact: "lag" } }) {
      name
    }
    interfaces {
      name
    }
  }
}

Expected Behavior

{
  "data": {
    "device": {
      "name": "dmi01-akron-rtr01",
      "lags": [
        {
          "name": "Po1"
        }
      ],
      "interfaces": [
        {
          "name": "GigabitEthernet0/0/0"
        },
        {
          "name": "GigabitEthernet0/0/1"
        },
        {
          "name": "GigabitEthernet0/1/0"
        },
        {
          "name": "GigabitEthernet0/1/1"
        },
        {
          "name": "GigabitEthernet0/1/2"
        },
        {
          "name": "GigabitEthernet0/1/3"
        },
        {
          "name": "GigabitEthernet0/1/4"
        },
        {
          "name": "GigabitEthernet0/1/5"
        },
        {
          "name": "GigabitEthernet0/1/6"
        },
        {
          "name": "GigabitEthernet0/1/7"
        },
        {
          "name": "GigabitEthernet0/1/8"
        },
        {
          "name": "Wlan-GigabitEthernet0/1/8"
        },
        {
          "name": "Cellular0/2/0"
        },
        {
          "name": "Po1"
        }
      ]
    }
  }
}

Observed Behavior

{
  "data": {
    "device": {
      "name": "dmi01-akron-rtr01",
      "lags": [
        {
          "name": "Po1"
        }
      ],
      "interfaces": [
        {
          "name": "Po1"
        }
      ]
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    severity: lowDoes not significantly disrupt application functionality, or a workaround is availabletopic: GraphQLtype: bugA confirmed report of unexpected behavior in the application

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions