Skip to content

[Feature]: Add assigned_object models in GraphQL API similar to the REST API #41

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

Open
ryanmerolle opened this issue Jul 21, 2022 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@ryanmerolle
Copy link
Collaborator

NetBox version

v3.2.6

Feature type

Add a function

Proposed functionality

NetBox core graphql package does not support walking assigned_object_type/assigned_object_id approach to relations.

Use case

It would be nice to walk from ACL to assigned devices, but you cannot currently.

External dependencies

graphql-python/graphene-django

@ryanmerolle ryanmerolle added the enhancement New feature or request label Jul 21, 2022
@ryanmerolle
Copy link
Collaborator Author

@ryanmerolle
Copy link
Collaborator Author

It looks like this was addressed with:

In netbox_acls/api/serializers.py I marked 2 spots with # TODO to address in our NetBox 3.4 compatible plugin version.

@ryanmerolle ryanmerolle self-assigned this Jan 21, 2023
@ryanmerolle ryanmerolle added this to the NetBox 3.4 milestone Jan 21, 2023
@ryanmerolle ryanmerolle reopened this Jan 23, 2023
@ryanmerolle ryanmerolle removed this from the NetBox 3.4 milestone Jan 23, 2023
@pheus
Copy link
Contributor

pheus commented Mar 25, 2025

I have tested assigned_object for both Device and VirtualMachine successfully. In the query, the object type must be specified using ... on DeviceType. However, as I understand the Feature Request, this is expected behavior.

Since the requested functionality is already supported, I believe this issue can be closed. If I have misunderstood the request, please let me know.

Example Query:

query MyQuery {
  access_list(id: "3") {
    id
    name
    assigned_object {
      ... on DeviceType {
        id
        name
      }
    }
  }
}

Example Response:

{
  "data": {
    "access_list": {
      "id": "3",
      "name": "Access-List-Standard1",
      "assigned_object": {
        "id": "1",
        "name": "switch-dc01"
      }
    }
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants