Skip to content
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

Validation of deep objects seems to be broken #5648

Closed
betabandido opened this issue Oct 9, 2019 · 2 comments · Fixed by #5657
Closed

Validation of deep objects seems to be broken #5648

betabandido opened this issue Oct 9, 2019 · 2 comments · Fixed by #5657

Comments

@betabandido
Copy link

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:

  1. Statically serve the swagger.json shown above
  2. Type some invalid JSON (e.g., foobar) in the only field
  3. Click execute
  4. 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:

Screen Shot 2019-10-09 at 11 31 57 AM

Old behavior where invalid JSON is detected:

Screen Shot 2019-10-09 at 11 32 58 AM

@shockey
Copy link
Contributor

shockey commented Oct 11, 2019

Looks like this was introduced in #5571:

c9c3b23#diff-47300e7ecd8989b6246221de88fc9a3cL524-R549

@shockey
Copy link
Contributor

shockey commented Oct 11, 2019

Fixed! Will be released today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants