You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
define a custom model field class BCharField(models.CharField): pass and use it instead.
write your BSerializerField(serializers.CharField)
patch the mapping into the root class: ModelSerializer.serializer_field_mapping[BCharField] = BSerializerField
use your OpenApiSerializerFieldExtension BFieldFix extension as is
this will hook into the model serializer creation and use your own serializer field instead. The extension in turn will see the field being used and apply the extension. This imho the cleanest way to achieve that change.
Imagine we have a following django model:
and a serializer:
Can I extend generated schema for field
b
ofASerializer
usingOpenApiSerializerFieldExtension
without explicitly redefining the serializer field as?
The text was updated successfully, but these errors were encountered: