drf-yasg
drf-yasg copied to clipboard
api/swagger/?format=openapi response 500
SwaggerGenerationError at /api/swagger/
Schema for <class 'rest_framework_mongoengine.serializers.DocumentSerializer.build_nested_embedded_field.<locals>.EmbeddedSerializer'> would override distinct serializer <class 'rest_framework_mongoengine.serializers.DocumentSerializer.build_nested_embedded_field.<locals>.EmbeddedSerializer'> because they implicitly share the same ref_name; explicitly set the ref_name attribute on both serializers' Meta classesRequest Method: | GET -- | -- http://localhost:8000/api/swagger/?format=openapi 3.1 SwaggerGenerationError Schema for <class 'rest_framework_mongoengine.serializers.DocumentSerializer.build_nested_embedded_field.<locals>.EmbeddedSerializer'> would override distinct serializer <class 'rest_framework_mongoengine.serializers.DocumentSerializer.build_nested_embedded_field.<locals>.EmbeddedSerializer'> because they implicitly share the same ref_name; explicitly set the ref_name attribute on both serializers' Meta classes /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/drf_yasg/inspectors/field.py, line 135, in field_to_swagger_object /usr/local/bin/python3 3.7.9 ['/Users/dp/idp/kscloud/code/TeamVision/teamvision_1.0_dev/teamvision', '/Library/Frameworks/Python.framework/Versions/3.7/lib/python37.zip', '/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7', '/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload', '/Users/dp/Library/Python/3.7/lib/python/site-packages', '/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages'] Fri, 04 Jun 2021 17:18:29 +0800
Hello, you can't have 2 serializers with the same name, the error message explains what you can do to fix the issue.