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

Extend support for tags

Open TmLev opened this issue 4 years ago • 7 comments

Currently, tags creation is based on the first word of URL/action. It's possible to overwrite tags with decorators but this leads to tedious repetitions.

It would be nice to add more ways to tag views – for example, schema_tags field in view classes:

class SomeView(APIView):
    queryset = SomeModel.objects.all()
    serializer_class = SomeModelSerializer
    schema_tags = ["model", "list"]

TmLev avatar Oct 19 '20 09:10 TmLev

I'm write and add this to this release (1.20)

JoelLefkowitz avatar Oct 20 '20 14:10 JoelLefkowitz

Just a heads up we've moved back to the original repo https://github.com/axnsan12/drf-yasg. I'll soon get round to writing this and submitting it there.

JoelLefkowitz avatar Oct 27 '20 13:10 JoelLefkowitz

Thanks, looking forward to it.

TmLev avatar Oct 27 '20 16:10 TmLev

Sorry to ask, but is there any update on this?

TmLev avatar Nov 06 '20 14:11 TmLev

Sorry to ask, but is there any update on this?

Gonna do this today, sorry for the delay

JoelLefkowitz avatar Nov 10 '20 15:11 JoelLefkowitz

@TmLev , please have a look at #83. By adding an override that picks up the class attribute we can add the extra tags. Views with more than tag are repeated in the ui. Is this what you had in mind? If we merge I'll open an issue to add the into the upstream repo.

JoelLefkowitz avatar Nov 10 '20 20:11 JoelLefkowitz

Yep, looks good to me! (Although, I'm not sure whether Cristi will approve this.)

TmLev avatar Nov 11 '20 07:11 TmLev