-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Validation of deep objects seems to be broken #5648
Description
Q&A (please complete the following information)
- OS: macOS
- Browser: chrome
- Version: 77
- Method of installation: copying dist folder and serving it statically
- Swagger-UI version: both master and 3.23.11
- Swagger/OpenAPI version: OpenAPI 3.0
Content & configuration
Example Swagger/OpenAPI definition:
{
"openapi": "3.0.1",
"info": {
"contact": {
"email": "[email protected]",
"name": "None"
},
"title": "None",
"version": "v1"
},
"servers": [{"url": "/api/v1"}],
"paths": {
"/test": {
"get": {
"summary": "test",
"parameters": [
{
"description": "test",
"in": "query",
"name": "map",
"style": "deepObject",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
}
],
"responses": {
"200": {
"description": "Success",
}
}
}
}
}
}Swagger-UI configuration options:
I use the default options. I simply copied the contents of the dist folder into a folder in my application. Then I created swagger.json in that folder, and I modified index.html to point to that JSON file. Swagger is statically served by a Go application.
Describe the bug you're encountering
If I enter a non-valid JSON into the text area for parameter map and I click execute, a spinning wheel appears and it just stays there forever. No request is received by the backend.
Older versions of swagger UI (e.g., 3.23.6 or 3.22.3) work correctly: the text area becomes red and a message stating that a valid JSON is required appears. So, the correct behavior must have been broken at some point after 3.23.6.
To reproduce...
Steps to reproduce the behavior:
- Statically serve the
swagger.jsonshown above - Type some invalid JSON (e.g., foobar) in the only field
- Click execute
- See error
Expected behavior
Swagger UI should behave as it did in previous versions.
Screenshots
Current behavior where spinning wheel appears and swagger UI freezes:
Old behavior where invalid JSON is detected:

