drf-yasg
drf-yasg copied to clipboard
Nested serializer in MultiPart form parser
Bug Report
Description
I am getting a drf_yasg.errors.SwaggerGenerationError: cannot instantiate nested serializer as Parameter
when using nested serializers with multi part form parser.
Stack trace / Error message
File "C:\Users\PC\Desktop\api\.venv\lib\site-packages\drf_yasg\inspectors\base.py", line 110, in probe_inspectors
result = method(obj, **kwargs)
File "C:\Users\PC\Desktop\api\.venv\lib\site-packages\drf_yasg\inspectors\field.py", line 86, in field_to_swagger_object
raise SwaggerGenerationError("cannot instantiate nested serializer as " + swagger_object_type.__name__)
drf_yasg.errors.SwaggerGenerationError: cannot instantiate nested serializer as Parameter
HTTP GET /?format=openapi 500 [3.81, 127.0.0.1:51926]
I've tried to solve this by using a serializer inspector and with that, changing the nested serializer as a dictionary of fields but that doesn't seem to work. Is there a workaround for this?
Any fix?
@nomidaepapi no not yet, as far as I am aware.
I also got the same issue while using the drf-writable-nested package.
Still no fix? unfortunately had to remove both form parser and multipart parse from my function definition which means the swagger docs can't take files for those endpoints in the documentation