Ah, I'm dumb - I was on an older version of DRF that didn't have the
`get_response|get_request` changes in. Fixed!

-Adam


On Sun, Aug 22, 2021 at 5:41 PM Adam Fletcher <[email protected]> wrote:

> I've tried:
>
> class CustomSchema(AutoSchema):
>     def get_request_serializer(self, path, method):
>         return ImportJsonSerializer()
>
>     def get_response_serializer(self, path, method):
>         return IngestionResultSerializer()
>
> class ImportJsonViewSet(viewsets.GenericViewSet):
>     permission_classes = (permissions.IsAuthenticated,)
>     schema = CustomSchema()
>     serializer_class = ImportJsonSerializer()
> ....
>
> But my OpenAPI schema doesn't reflect the CustomSchema - for example, the
> request & response in my create() method are both set to the value of
> serializer_class
>
> Now, I could get rid of the serializer class - or override the method
> get_serializer_class(), but that's not what AutoSchema is using to
> determine the schema.
>
> Thoughts?
>
>
>
> On Sun, Aug 22, 2021 at 4:40 PM Adam Fletcher <[email protected]> wrote:
>
>> Hi DRFers,
>>
>> I'd like to let the schema generator know I have one serializer for my
>> request and one for my response in my create() method. How do I do this?
>>
>> -Adam
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-rest-framework/CAEP43uPwrt3UpzKZ3CftL4iHfC0HASKAfH87UM47kTbWv-4Vtg%40mail.gmail.com.

Reply via email to