Skip to content

Field name "entries" in a schema causes swagger-ui javascript error and fails to load #6016

@mke1ms

Description

@mke1ms

Problem

The openapi definition below has a schema with a field name called "entries". This causes the ui to throw a javascript error "e.entries is not a function" (see the screenshot below).

This behavior only started Friday May 15th 2020 at around 15:00 CET. Before that swagger-ui had no problems loading a schema containing a field called entries, so I am assuming something changed in the bundle I use from the url above.

Example Swagger/OpenAPI definition:

{
  "openapi": "3.0.2",
  "info": {
    "title": "FastAPI",
    "version": "0.1.0"
  },
  "paths": {
    "/test/": {
      "get": {
        "summary": "Test",
        "operationId": "test_test__get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Testmodel"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Testmodel": {
        "title": "Testmodel",
        "required": [
          "name",
          "entries"
        ],
        "type": "object",
        "properties": {
          "name": {
            "title": "Name",
            "type": "string"
          },
          "entries": {
            "title": "Entries",
            "type": "integer"
          }
        }
      }
    }
  }
}

Screenshot

image

To reproduce...

Try to load swagger ui using the openapi.json above

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