Skip to content

Typeless schemas in parameters crash SwaggerUI #5951

@tim-lai

Description

@tim-lai

Q&A (please complete the following information)

  • OS: [e.g. macOS]
  • Browser: [e.g. chrome, safari]
  • Version: [e.g. 22]
  • Method of installation: [e.g. npm, dist assets]
  • Swagger-UI version: [e.g. 3.10.0]
  • Swagger/OpenAPI version: [e.g. Swagger 2.0, OpenAPI 3.0]

Content & configuration

Example Swagger/OpenAPI definition:

openapi: 3.0.0
info:
  description: No type for schema
  version: "1"
  title: "No type"
paths:
  /one:
    parameters:
      - name: namespace
        description: The custom resource's namespace
        schema:
        in: path
        required: true
    get:
      description: sf
      responses:
        default:
          description: one

Describe the bug you're encountering

When a schema does not have a type in a parameter, it will crash SwaggerUI.

To reproduce...

Copy above YAML to editor.swagger.io:
Then open the GET operation in swaggerUi.

Result: Console crashes where setDefaultValue cannot perform a toJS() on a null.

This can put the spec in an unusable state.

Expected behavior

Screenshots

Additional context or thoughts

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions