Open ayushin opened 2 years ago
Alternatively, somewhere in your project?
from drf_yasg import openapi
from drf_yasg.inspectors.field import model_field_to_basic_type
from hashid_field.field import HashidFieldMixin
model_field_to_basic_type.insert(
0, (HashidFieldMixin, (openapi.TYPE_STRING, None)),
)
This is related https://github.com/axnsan12/drf-yasg/issues/383
However this requires overriding the entire generator
get_path_parameters
method in its entirety just to be able to do:While I agree
HashidField
implementation is somewhere incorrect, it would be great to have something likeSWAGGER_BASIC_TYPE_INFO_OVERRIDES
so thatget_basic_type_info
would first look there.Then an easy solution would be:
Any other ideas how to fix this easier?