Forum Discussion

nobody1's avatar
nobody1
New Member
6 years ago
Solved

how do you specify a custom serializer for your models in Swagger UI 2.x?

Hi, I'm upgrading from Swagger 0.3.x to 2.x:

 

In 0.3.x, you could specify a custom model serializer via a docstring YAML comment, e.g.

https://django-rest-swagger.readthedocs.io/en/stable-0.3.x/yaml.html

 

def retrieve(self, request, *args, **kwargs):
"""
Get domain details.

Example Response:\n
{
"id": "blah"
}
---
# YAML (for swagger documentation after the ---)
serializer: ..serializers.MySerializer

 

I'm not seeing how to do this in Swagger [UI] 2.x.

Thanks!

  • swagger-rest-swagger is not one of our projects, so we're unable to provide support for it. You best bet is to file a ticket with the project.

1 Reply

  • swagger-rest-swagger is not one of our projects, so we're unable to provide support for it. You best bet is to file a ticket with the project.