axnsan12 / drf-yasg

Automated generation of real Swagger/OpenAPI 2.0 schemas from Django REST Framework code.
https://drf-yasg.readthedocs.io/en/stable/
Other
3.43k stars 439 forks source link

RecursiveField schema generation is not working #613

Open mbrancato opened 4 years ago

mbrancato commented 4 years ago

It looks like the support for RecursiveField added in #109 is no longer working. The Swagger UI won't load and presents an error. I noticed there is no test for this field type in the /tests/ folder as well - I'd help create one but I'm having some difficulty getting all the requirements to install.

relevant versions:

djangorestframework==3.9.3
djangorestframework-recursive==0.1.2
drf-yasg==1.17.1

Using a simple example like this:

class TestResponseSerializer(serializers.Serializer):
    parent = RecursiveField()

@swagger_auto_schema(
    query_serializer=TestRequestSerializer,
    responses={200: TestResponseSerializer},
)
@action(detail=False, methods=["get"])
def test(self, request):
    ...

The error is the following:

AssertionError: #/definitions/TestResponse is not defined
axnsan12 commented 4 years ago

Interesting that this slipped by without tests. Would be nice to fix.

JoelLefkowitz commented 4 years ago

I'll take a look into this

aprilahijriyan commented 3 years ago

Any progress here?