drf-yasg icon indicating copy to clipboard operation
drf-yasg copied to clipboard

RecursiveField schema generation is not working

Open mbrancato opened this issue 4 years ago • 3 comments

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

mbrancato avatar Jul 09 '20 20:07 mbrancato

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

axnsan12 avatar Oct 25 '20 23:10 axnsan12

I'll take a look into this

JoelLefkowitz avatar Oct 27 '20 13:10 JoelLefkowitz

Any progress here?

aprilahijriyan avatar May 30 '21 20:05 aprilahijriyan