Skip to content

GraphQL: Querying of cable within a cabletermination_set of an device can only return the ID but no the corresponding cable #18124

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

Closed
dxks opened this issue Nov 29, 2024 · 2 comments · Fixed by #18238
Assignees
Labels
severity: low Does not significantly disrupt application functionality, or a workaround is available status: accepted This issue has been accepted for implementation topic: GraphQL type: bug A confirmed report of unexpected behavior in the application

Comments

@dxks
Copy link
Contributor

dxks commented Nov 29, 2024

Deployment Type

Self-hosted

Triage priority

N/A

NetBox Version

v4.1.7

Python Version

3.11

Steps to Reproduce

Create a simple GraphQL query to get all cable-terminations of an device and retrieve the cable information:

{
  device(id: 249) {
    cabletermination_set {
      cable {
        display
      }
    }
  }
}

You will retrieve the following error:

{
  "data": null,
  "errors": [
    {
      "message": "Cannot query field 'display' on type 'DjangoModelType'.",
      "locations": [
        {
          "line": 2,
          "column": 61
        }
      ]
    }
  ]
}

Expected Behavior

Retrieve the cable details on the cable-termination:

{
  "data": {
    "device": {
      "cabletermination_set": [
        {
          "cable": {
            "display": "#2452"
          }
        }
      ]
    }
  }
}

Observed Behavior

The cable of cabletermination_set is referencing ModelDjangoType instead of CableType. Querying the cable will only possible when querying the terminations and cable there.

@dxks dxks added status: needs triage This issue is awaiting triage by a maintainer type: bug A confirmed report of unexpected behavior in the application labels Nov 29, 2024
@arthanson arthanson added status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation severity: low Does not significantly disrupt application functionality, or a workaround is available and removed status: needs triage This issue is awaiting triage by a maintainer labels Dec 3, 2024
@dxks
Copy link
Contributor Author

dxks commented Dec 4, 2024

I had a look into this and see that other CabledModels uses a Mixin but this will not fit here. So in general the CableTerminationType just needs the Cable-Annotation to the CableType. I checked this and could provide a Pull-Request for this:

develop...dxks:netbox:18124-graphql-query-cable-inside-cabletermination-set

@arthanson arthanson added status: accepted This issue has been accepted for implementation and removed status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation labels Dec 5, 2024
@arthanson
Copy link
Collaborator

@dxks I've assigned this issue to you said you could create a PR for this.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 17, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
severity: low Does not significantly disrupt application functionality, or a workaround is available status: accepted This issue has been accepted for implementation topic: GraphQL type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants