Search code examples
djangoescapingswaggerdocstring

Django swagger special character escape documentation


I use django and swagger. I write doc string in my django function like this :

/?first_name__icontains=saeed&age__gte=20. 

But swagger show them like this

enter image description here

how can I escape characters like & in django and swagger?

Edit:

My code in docstring of a django view enter image description here

Result in Swagger enter image description here


Solution

  • & being rendered as & in code blocks is a bug in Swagger UI 2.x which was fixed in UI 3.3.0: https://github.com/swagger-api/swagger-ui/issues/2700

    You need to update your Swagger UI version.