Skip to content

Add an array field type to Custom Objects #675

Description

@bctiemann

Plugin Version

v0.6.0

Proposed functionality

Add a first-class array field type, backed by Postgres/Django's ArrayField (including support for nested arrays with a fixed element size), with an element schema — distinct from the existing unstructured json field type, which doesn't validate shape and can't be filtered positionally. Today the Custom Objects field-type enum has no array type.

Use case

netbox-physical-geometry's Zone and Path models store geometry as a nested array of (x, y, z) integer triplets:

coordinates = ArrayField(
    ArrayField(models.PositiveIntegerField(), size=3),  # (x, y, z) coords for each point
    validators=[MinLengthValidator(2)],
)

The existing coordinates field type (added in v0.6.0) only covers a single lat/lon pair and doesn't cover a variable-length list of coordinate triplets. This is a lower-priority, narrower gap — only 1 of 9 surveyed plugins is affected, and it's a fairly geometric outlier — but a first-class array type with an element schema would close this gap and would likely be more broadly useful than a one-off geometry-specific field.

External dependencies

None — reuses Postgres/Django's existing ArrayField support.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions