mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-27 19:08:38 -06:00
Fix OpenAPI schema for vid_ranges in VLANGroup so it shows up
This commit is contained in:
parent
70dddb673b
commit
6ba38dc26a
@ -158,7 +158,29 @@ class RelatedObjectCountField(serializers.ReadOnlyField):
|
|||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
_integer_range_schema = {
|
||||||
|
'type': 'array',
|
||||||
|
'items': {
|
||||||
|
'type': 'integer',
|
||||||
|
},
|
||||||
|
'minItems': 2,
|
||||||
|
'maxItems': 2,
|
||||||
|
}
|
||||||
|
|
||||||
|
@extend_schema_field({
|
||||||
|
'type': 'array',
|
||||||
|
'items': _integer_range_schema,
|
||||||
|
})
|
||||||
|
class IntegerRangeListSerializer(serializers.ListSerializer):
|
||||||
|
# this special class is only here to work around
|
||||||
|
# https://github.com/tfranzel/drf-spectacular/issues/1353
|
||||||
|
pass
|
||||||
|
|
||||||
|
@extend_schema_field(_integer_range_schema)
|
||||||
class IntegerRangeSerializer(serializers.Serializer):
|
class IntegerRangeSerializer(serializers.Serializer):
|
||||||
|
class Meta:
|
||||||
|
list_serializer_class = IntegerRangeListSerializer
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Represents a range of integers.
|
Represents a range of integers.
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user