From 31c909c368e3a09498da95ed8fe728449ae2802b Mon Sep 17 00:00:00 2001 From: Arthur Date: Mon, 17 Apr 2023 14:16:36 -0700 Subject: [PATCH] #12149 remove spectacular choice mapping fixup internal one --- netbox/core/api/schema.py | 3 ++- netbox/netbox/settings.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/netbox/core/api/schema.py b/netbox/core/api/schema.py index 0b44a3d52..e938c01cf 100644 --- a/netbox/core/api/schema.py +++ b/netbox/core/api/schema.py @@ -10,6 +10,7 @@ from drf_spectacular.plumbing import ( ComponentRegistry, ResolvedComponent, build_basic_type, + build_choice_field, build_media_type_object, build_object_type, is_serializer, @@ -38,7 +39,7 @@ class ChoiceFieldFix(OpenApiSerializerFieldExtension): def map_serializer_field(self, auto_schema, direction): if direction == 'request': - return build_basic_type(OpenApiTypes.STR) + return build_choice_field(self.target) elif direction == "response": return build_object_type( diff --git a/netbox/netbox/settings.py b/netbox/netbox/settings.py index df9160621..037e3a754 100644 --- a/netbox/netbox/settings.py +++ b/netbox/netbox/settings.py @@ -589,6 +589,7 @@ SPECTACULAR_SETTINGS = { 'SWAGGER_UI_DIST': 'SIDECAR', 'SWAGGER_UI_FAVICON_HREF': 'SIDECAR', 'REDOC_DIST': 'SIDECAR', + 'POSTPROCESSING_HOOKS': [], } #