Skip to content

GraphQL: Extend relationships further #9478

Closed
@ryanmerolle

Description

@ryanmerolle

NetBox version

v3.2.4

Feature type

Change to existing functionality

Proposed functionality

I am not really going to articulate this well, but I have noticed many GraphQL models do not go very deep into the relationships of other models.

Use case

Examples:

{
  circuit_list {
    id
    cid
    type {
      name
    }
    termination_a {
      _link_peer_type {
        id
      }
    termination_b {
      _link_peer_type {
        id
      }
      _link_peer_id
    }
  }
}

termination_a & termination_b do not (at bare minimum) allow you to grab the display or device keys like you can with the REST API. In reality, you should be able to further follow the path of the relationship to include information about the models related.

Possible Use Cases:
Gather circuit, termination, cable, ip address, and connected peer device/interface/ip details
Filtering circuits based on the status of the site it's attached to @tyler-8 example from chat
Filtering circuits based on the VLAN membership of the interface it's connected to @tyler-8 example from chat.

There are a whole host of items like this where the relationship cannot be followed to the end within graphql. To quote @tyler-8 "Yeah graphql would really shine if we unlocked more of that" .."I'm just not sure how that works in graphene, like if it's "easy" to do that or if you basically have to explicitly define all of those things every time"

Database changes

No response

External dependencies

No response

Metadata

Metadata

Assignees

Labels

status: acceptedThis issue has been accepted for implementationtype: featureIntroduction of new functionality to the application

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions