netbox icon indicating copy to clipboard operation
netbox copied to clipboard

GraphQL: Extend relationships further

Open ryanmerolle opened this issue 3 years ago • 2 comments

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

ryanmerolle avatar Jun 03 '22 16:06 ryanmerolle

Since I am creating Switch-Configs from the Information stored in Netbox, the possibility to have the connected_endpoint on an interface would be a real gamechanger.

basti1508 avatar Jun 20 '22 13:06 basti1508

Blocked by #9856

jeremystretch avatar Jul 27 '22 18:07 jeremystretch