Skip to content

Validation of deep objects seems to be broken #5648

Closed

Description

@betabandido

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": "none@none.com",
      "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

Activity

  1. shockey commented on Oct 11, 2019

    @shockey
    Contributor
  2. shockey commented on Oct 11, 2019

    @shockey
    Contributor

    Fixed! Will be released today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions