15404 schema map for SerializedPKRelatedField

This commit is contained in:
Arthur 2024-03-15 12:02:19 -07:00
parent 4adb44f60d
commit 397d475159
1 changed files with 7 additions and 0 deletions

View File

@ -47,6 +47,13 @@ class ChoiceFieldFix(OpenApiSerializerFieldExtension):
)
class SerializedPKRelatedFieldFix(OpenApiSerializerFieldExtension):
target_class = "netbox.api.fields.SerializedPKRelatedField"
def map_serializer_field(self, auto_schema, direction):
return auto_schema._map_serializer(self.target.serializer, direction)
class NetBoxAutoSchema(AutoSchema):
"""
Overrides to drf_spectacular.openapi.AutoSchema to fix following issues: