Skip to content

Add assigned_object models in GraphQL API similar to the REST API #9817

Closed
@ryanmerolle

Description

@ryanmerolle

NetBox version

v3.3-beta

Feature type

Change to existing functionality

Proposed functionality

As an example, currently you can only query:

{
  l2vpn_termination_list {
    assigned_object_type {
      model
    }
    assigned_object_id
  }
}

and it returns:

{
  "data": {
    "l2vpn_termination_list": [
      {
        "assigned_object_type": {
          "model": "interface"
        },
        "assigned_object_id": 1170
      }
    ]
  }
}

Where the rest api allows you to query the same model and get the assigned_object back:

{
  "count": 1,
  "next": null,
  "previous": null,
  "results": [
    {
      "id": 1,
      "url": "https://beta-demo.netbox.dev/api/ipam/l2vpn-terminations/1/",
      "display": "et-2/0/49 <> Test",
      "l2vpn": {
        "id": 1,
        "url": "https://beta-demo.netbox.dev/api/ipam/l2vpns/1/",
        "display": "Test",
        "identifier": null,
        "name": "Test",
        "slug": "test",
        "type": "vxlan-evpn"
      },
      "assigned_object_type": "dcim.interface",
      "assigned_object_id": 1170,
      "assigned_object": {
        "id": 1170,
        "url": "https://beta-demo.netbox.dev/api/dcim/interfaces/1170/",
        "display": "et-2/0/49",
        "device": {
          "id": 99,
          "url": "https://beta-demo.netbox.dev/api/dcim/devices/99/",
          "display": "r105-torsw:2 (99)",
          "name": null
        },
        "name": "et-2/0/49",
        "cable": null,
        "_occupied": false
      },
      "tags": [],
      "custom_fields": {},
      "created": "2022-07-21T09:45:29.104279Z",
      "last_updated": "2022-07-21T09:45:29.104304Z"
    }
  ]

It would be ideal that all usage of any assigned_object/assigned_object_type approach would update the graphql api to return the assigned_object.

Use case

rest and graphql feature parity.

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