How to customize drf-yasg schema in ClassBased django views?
I tried this part of code, but the generated swagger doesn't respect the change.
class CustomView(CreateAPIView):
permission_classes = (IsAuthenticated,)
serializer_class = CustomSerializer
@swagger_auto_schema(request_body=openapi.Schema(
type=openapi.TYPE_OBJECT,
properties={
'phone': openapi.Schema(type=openapi.TYPE_STRING, description='string'),
'body': openapi.Schema(type=openapi.TYPE_STRING, description='string'),
}))
def create(self, request: Request, *args, **kwargs):
phone = request.data.get('phone')
body = request.data.get('body')
...