|
def extend_schema_field( |
|
field: Union[_SerializerType, Field, OpenApiTypes, Dict], |
I would suggest also allowing Type[Field] to be passed in. I tried it out and it seems to work, but type checking will fail unless you pass an instance.
@extend_schema_field(field=_CustomField)
class CustomJSONField(JSONField):
...
Perhaps it would make more sense to only allow passing in Type[Field]? Not sure why an instance would make sense in this context (but Serializer instances are also currently allowed, so to be consistent it should probably allow Field instances too).
drf-spectacular/drf_spectacular/utils.py
Lines 401 to 402 in 9ab8d44
I would suggest also allowing
Type[Field]to be passed in. I tried it out and it seems to work, but type checking will fail unless you pass an instance.Perhaps it would make more sense to only allow passing in
Type[Field]? Not sure why an instance would make sense in this context (butSerializerinstances are also currently allowed, so to be consistent it should probably allowFieldinstances too).