Make it possible to add relations to plugin models to GraphQL types #10391

Closed
opened 2025-12-29 21:30:49 +01:00 by adam · 3 comments
Owner

Originally created by @peteeckel on GitHub (Oct 22, 2024).

NetBox version

v4.1.4

Feature type

New functionality

Triage priority

N/A

Proposed functionality

Currently the relations that can be retrieved with the GraphQL TenantType object type are hard-coded in tenancy/graphql/types.py.

I suggest adding a way to register plugin models with GraphQL so that it's possible to retrieve plugin objects together with tenanty, like this:

query { tenant_list { plugin_object { id } } }

Currently only the opposite direction works:

query { plugin_object_list { tenant { name } } }

Use case

I am maintaining a plugin that supports tenancy for some of its models. It would be useful be able to get a list of plugin objects when querying a tenant.

Database changes

None

External dependencies

No response

Originally created by @peteeckel on GitHub (Oct 22, 2024). ### NetBox version v4.1.4 ### Feature type New functionality ### Triage priority N/A ### Proposed functionality Currently the relations that can be retrieved with the GraphQL `TenantType` object type are hard-coded in `tenancy/graphql/types.py`. I suggest adding a way to register plugin models with GraphQL so that it's possible to retrieve plugin objects together with tenanty, like this: ``` query { tenant_list { plugin_object { id } } } ``` Currently only the opposite direction works: ``` query { plugin_object_list { tenant { name } } } ``` ### Use case I am maintaining a plugin that supports tenancy for some of its models. It would be useful be able to get a list of plugin objects when querying a tenant. ### Database changes None ### External dependencies _No response_
adam added the type: featurestatus: duplicatenetbox labels 2025-12-29 21:30:49 +01:00
adam closed this issue 2025-12-29 21:30:49 +01:00
Author
Owner

@TribuneX commented on GitHub (Oct 22, 2024):

This request seems to ask for a similar feature.

@TribuneX commented on GitHub (Oct 22, 2024): [This request](https://github.com/129828) seems to ask for a similar feature.
Author
Owner

@peteeckel commented on GitHub (Oct 22, 2024):

Um ... which request? The link is to a user.
[Edit] Found it: https://github.com/netbox-community/netbox/issues/17242

@peteeckel commented on GitHub (Oct 22, 2024): Um ... which request? The link is to a user. [Edit] Found it: https://github.com/netbox-community/netbox/issues/17242
Author
Owner

@peteeckel commented on GitHub (Oct 22, 2024):

Apparently yes - didn't find it in my initial search. I'm closing this one.

@peteeckel commented on GitHub (Oct 22, 2024): Apparently yes - didn't find it in my initial search. I'm closing this one.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#10391