Skip to content
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

Expose depth and child count on prefix REST API serializer #6501

Closed
jeremystretch opened this issue May 28, 2021 · 0 comments
Closed

Expose depth and child count on prefix REST API serializer #6501

jeremystretch opened this issue May 28, 2021 · 0 comments
Assignees
Labels
status: accepted This issue has been accepted for implementation type: feature Introduction of new functionality to the application

Comments

@jeremystretch
Copy link
Member

NetBox version

v2.11.4

Feature type

Change to existing functionality

Proposed functionality

Add two read-only fields to the REST API serializer for the ipam.Prefix model:

  • _depth: Depth in the prefix hierarchy (e.g. a root-level prefix will have a depth of zero)
  • children: The number of child prefixes contained within this prefix

The leading underscore in the name of the depth field is consistent with models which employ MPTT to maintain a hierarchy, such as dcim.Region.

Use case

Following the work implemented under #6087, it is now possible to include this data with no performance impact.

Database changes

No response

External dependencies

No response

@jeremystretch jeremystretch added type: feature Introduction of new functionality to the application status: accepted This issue has been accepted for implementation labels May 28, 2021
@jeremystretch jeremystretch self-assigned this May 28, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: accepted This issue has been accepted for implementation type: feature Introduction of new functionality to the application
Projects
None yet
Development

No branches or pull requests

1 participant