Swagger UI does not show request parameter's validation information. I want to show parameter's min value, max value, format, pattern(regex). Does anyone know the way how I express the parameter's validation information on Swagger UI?
Asked
Active
Viewed 1,721 times
2
-
How did you install Swagger UI? Do you use the vanilla version downloaded from the [repository](https://github.com/swagger-api/swagger-ui) (or installed via npm), or do you use Swagger UI bundled with some framework/library (e.g. Swashbuckle or Springfox)? – Helen Dec 03 '18 at 09:57
2 Answers
0
Assuming you use Swagger UI 3.x (the latest version), add showCommonExtensions: true
to the Swagger UI initialization code in your index.html
file:
const ui = SwaggerUIBundle({
"dom_id": "#swagger-ui",
url: "https://petstore.swagger.io/v2/swagger.json",
showCommonExtensions: true, // <-----
...

Helen
- 87,344
- 17
- 243
- 314
-1
By using openapi 3.0.0 I got a UI with validation information like that displayed in http://editor.swagger.io/. Conversion from openapi 2 to openapi 3 could be done at the following URL. https://mermade.org.uk/openapi-converter

gnk
- 149
- 15