Skip to content

REST API docs: vid_ranges POST example for VLANGroup is triple‑nested ([[[lo, hi]]]) instead of [[lo, hi]] #20494

@pheus

Description

@pheus

NetBox Edition

NetBox Community

NetBox Version

v4.4.2

Python Version

3.12

Steps to Reproduce

  1. Open /api/schema/swagger-ui/.
  2. Go to IPAM → VLAN groups → POST /api/ipam/vlan-groups/.
  3. Inspect the request body “Example Value”.

Expected Behavior

vid_ranges should be a list of two‑integer ranges:

"vid_ranges": [[10, 20]]

Observed Behavior

vid_ranges is shown with an extra nesting level:

"vid_ranges": [[[0, 0]]]

Additional Information

The OpenAPI serializer extension for IntegerRangeSerializer returns an array of arrays for a single range; with many=True on vid_ranges, drf‑spectacular wraps it again, causing triple nesting.

Proposed Fix (schema extension)

# netbox/core/api/schema.py
class FixIntegerRangeSerializerSchema(OpenApiSerializerExtension):
    target_class = 'netbox.api.fields.IntegerRangeSerializer'

    def map_serializer(self, auto_schema, direction):
        # One range = two integers; many=True will wrap this in an outer array
        return {
            "type": "array",
            "items": {"type": "integer"},
            "minItems": 2,
            "maxItems": 2,
        }

Metadata

Metadata

Assignees

Labels

severity: lowDoes not significantly disrupt application functionality, or a workaround is availablestatus: acceptedThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the application

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions