-
Notifications
You must be signed in to change notification settings - Fork 440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for SerializerMethodField? #137
Comments
Actually thinking about this, hinting the return type wouldn't help much, since that's not going to give you the serializer class. My main use case for this is where I have a SerializerMethodField that uses a serializer class in its implementation. So maybe it'd be more useful to have a decorator for use with the SerializerMethodField methods a bit like Something like:
|
This could work and seems like a clean enough API.
Something to consider is that the return value will not necessarily be a serializer-generated object (i.e. it could be a plain |
Hmm, is there a work-around for the time being? We have a similar issue where we're returning an int, but YASG thinks it's a string. |
It would be useful for drf-yasg to support SerializerMethodField - I've not tried this yet, but I wonder if using py3.5+ type hinting to get the return type of the serializer method would work?
The text was updated successfully, but these errors were encountered: