Skip to content
This repository has been archived by the owner on Jan 11, 2021. It is now read-only.

No action provided in get_serializer_class #119

Closed
dochead opened this issue Sep 17, 2014 · 2 comments
Closed

No action provided in get_serializer_class #119

dochead opened this issue Sep 17, 2014 · 2 comments

Comments

@dochead
Copy link

dochead commented Sep 17, 2014

I'm trying to override specific serializers within a view and providing a get_serializer_class seems to work fine for DRF. However, when swagger introspects the viewset I can't seem to see any way of getting the action or path from the request so am unable to provide the right serializer.

It there any way around this? I've tried setting self.serializer_class within the action itself but that (obviously) isn't even called by Swagger.

@dochead dochead changed the title No action provided in get_serializer No action provided in get_serializer_class Sep 17, 2014
@pySilver
Copy link
Contributor

how do you suppose rest swagger to call static code? especially when get_serializer_class may contain logic that is bounded to a request object.

IMO, you should use YAML format for this and define your serializer directly in docstring (thats what we do). Take a look at my pull request: #60 feel free to fork and finish it so @marcgibbons will merge it into master. (im out of time lastly)

@ariovistus
Copy link
Contributor

#184 ought to have fixed this. It's in pypi now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants