Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Graphql filters to same attribute #17883

Open
SRF-rueeggdo opened this issue Oct 29, 2024 · 1 comment
Open

Graphql filters to same attribute #17883

SRF-rueeggdo opened this issue Oct 29, 2024 · 1 comment
Labels
status: revisions needed This issue requires additional information to be actionable type: bug A confirmed report of unexpected behavior in the application

Comments

@SRF-rueeggdo
Copy link

Deployment Type

Self-hosted

Triage priority

N/A

NetBox Version

v4.1.4

Python Version

3.11

Steps to Reproduce

  1. execute the following query in the GraphiQL web interface. It should work.
  2. run the query below as a curl command. This will return an error.

GraphiQL:

{
  border_leaf_list: device_list(
    filters: {tag: "avd", virtual_chassis_member: false, status: "active", role: "border-leaf", site: "iplab"}
  ) {
    name
    loopback_interfaces: interfaces(filters: {type: {exact: "virtual"}}) {
      name
      description
      type
      ip_addresses {
        address
        vrf {
          name
        }
      }
    }
    svi_interfaces: interfaces(filters: {type: {exact: "bridge"}}) {
      name
      description
      type
      ip_addresses {
        address
      }
    }
  }
}

CLI:

curl -H "Authorization: Token YOURTOKEN" \
     -H "Content-Type: application/json" \
     -H "Accept: application/json" \
     https://YOURURL/graphql/ \
     --data '{"query": "query {border_leaf_list: device_list(filters: {tag: \"avd\", virtual_chassis_member: false, status: \"active\", role: \"border-leaf\", site: \"iplab\"}) {name loopback_interfaces: interfaces(filters: {type: {exact: \"virtual\"}}) {name description type ip_addresses {address vrf {name}}} svi_interfaces: interfaces(filters: {type: {exact: \"bridge\"}}) {name description type ip_addresses {address}}}}"}'

Expected Behavior

The query should return this.

{
  "data": {
    "border_leaf_list": [
      {
        "name": "ZHFER-SCB9211-A",
        "svi_interfaces": []
      },
      {
        "name": "ZHFER-SCB9211-B",
        "svi_interfaces": []
      }
    ]
  }
}

Observed Behavior

The curl command returns this insted.

{"data": null, "errors": [{"message": "Tried to prefetch 2 queries with different filters to the same attribute. Use `to_attr` in this case...", "locations": [{"line": 1, "column": 8}], "path": ["border_leaf_list"]}]}
@SRF-rueeggdo SRF-rueeggdo added status: needs triage This issue is awaiting triage by a maintainer type: bug A confirmed report of unexpected behavior in the application labels Oct 29, 2024
@arthanson
Copy link
Collaborator

@SRF-rueeggdo Thank you for opening a bug report. Unfortunately, the information you have provided is not sufficient for someone else to attempt to reproduce the reported behavior. Remember, each bug report must include detailed steps that someone else can follow on a clean, empty NetBox installation to reproduce the exact problem you're experiencing. These instructions should include the creation of any involved objects, any configuration changes, and complete accounting of the actions being taken. Also be sure that your report does not reference data on the public NetBox demo, as that is subject to change at any time by an outside party and cannot be relied upon for bug reports.

You have provided the expected output, but haven't provided how to setup the data to get this output, can you please provide steps that input the data for the GraphQL query to run against.

@arthanson arthanson added status: revisions needed This issue requires additional information to be actionable and removed status: needs triage This issue is awaiting triage by a maintainer labels Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: revisions needed This issue requires additional information to be actionable type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

No branches or pull requests

2 participants