mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-20 02:06:42 -06:00
Merge branch 'develop-2.7' into 2248-svg-rack-elevations
This commit is contained in:
commit
20c8abe8da
@ -75,7 +75,7 @@ class CustomChoiceFieldInspector(FieldInspector):
|
|||||||
SwaggerType, _ = self._get_partial_types(field, swagger_object_type, use_references, **kwargs)
|
SwaggerType, _ = self._get_partial_types(field, swagger_object_type, use_references, **kwargs)
|
||||||
|
|
||||||
if isinstance(field, ChoiceField):
|
if isinstance(field, ChoiceField):
|
||||||
value_schema = openapi.Schema(type=openapi.TYPE_INTEGER)
|
value_schema = openapi.Schema(type=openapi.TYPE_STRING)
|
||||||
|
|
||||||
choices = list(field._choices.keys())
|
choices = list(field._choices.keys())
|
||||||
if set([None] + choices) == {None, True, False}:
|
if set([None] + choices) == {None, True, False}:
|
||||||
@ -83,7 +83,7 @@ class CustomChoiceFieldInspector(FieldInspector):
|
|||||||
# differentiated since they each have subtly different values in their choice keys.
|
# differentiated since they each have subtly different values in their choice keys.
|
||||||
# - subdevice_role and connection_status are booleans, although subdevice_role includes None
|
# - subdevice_role and connection_status are booleans, although subdevice_role includes None
|
||||||
# - face is an integer set {0, 1} which is easily confused with {False, True}
|
# - face is an integer set {0, 1} which is easily confused with {False, True}
|
||||||
schema_type = openapi.TYPE_INTEGER
|
schema_type = openapi.TYPE_STRING
|
||||||
if all(type(x) == bool for x in [c for c in choices if c is not None]):
|
if all(type(x) == bool for x in [c for c in choices if c is not None]):
|
||||||
schema_type = openapi.TYPE_BOOLEAN
|
schema_type = openapi.TYPE_BOOLEAN
|
||||||
value_schema = openapi.Schema(type=schema_type)
|
value_schema = openapi.Schema(type=schema_type)
|
||||||
|
Loading…
Reference in New Issue
Block a user