-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Labels
severity: lowDoes not significantly disrupt application functionality, or a workaround is availableDoes not significantly disrupt application functionality, or a workaround is availablestatus: acceptedThis issue has been accepted for implementationThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the applicationA confirmed report of unexpected behavior in the application
Milestone
Description
NetBox Edition
NetBox Community
NetBox Version
v4.4.2
Python Version
3.12
Steps to Reproduce
- Open
/api/schema/swagger-ui/
. - Go to IPAM → VLAN groups → POST /api/ipam/vlan-groups/.
- 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 availableDoes not significantly disrupt application functionality, or a workaround is availablestatus: acceptedThis issue has been accepted for implementationThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the applicationA confirmed report of unexpected behavior in the application