Enable accessing related object attributes via dotted path when defining custom validation rules #15490
Labels
status: accepted
This issue has been accepted for implementation
type: feature
Introduction of new functionality to the application
Milestone
NetBox version
v3.7.4
Feature type
New functionality
Proposed functionality
When defining custom validation rules as JSON, it is currently possible to access only direct attributes on an object. For example:
It is not possible to reference an attribute of a related object; this would require creating a CustomValidator subclass in Python with a custom
validate()
method as discussed here.This issue proposes a mechanism for referencing attributes of related objects, identified by a dotted path. For example, the following would reference a the name of a site's assigned region:
This could be achieved by employing Python's
operator.attrgetter()
utility.Use case
This enhancement will allow users to reach "deeper" into an object when validating it without the need to write a custom subclass in Python.
Database changes
None
External dependencies
None
The text was updated successfully, but these errors were encountered: