Skip to content

Bad indentation of definition breaks Models component #4737

@plavski

Description

@plavski

Q&A (please complete the following information)

  • OS: macOS
  • Browser: chrome
  • Version: 67
  • Method of installation: npm
  • Swagger-UI version: 3.17.4
  • Swagger/OpenAPI version: Swagger 2.0

Content & configuration

Example Swagger/OpenAPI definition:

swagger: "2.0"
info:
  description: This is a simple API
  version: 1.0.0
  title: Simple Inventory API

paths:
  /inventory:
    get:
      responses:
        200:
          description: search results matching criteria
        400:
          description: bad input parameter
definitions:
    InventoryItem:
      type: object

Describe the bug you're encountering

A definition with only one model, when incorrectly indented, will crash the Models component.

To reproduce...

Steps to reproduce the behavior:

  1. Load above YAML
  2. Indent InventoryItem so it is inline with type: object
  3. Models component crashes with error

Expected behavior

InventoryItem and type to become individual definitions

Screenshots

screen shot 2018-07-17 at 11 56 39

Additional context or thoughts

Seems to be an issue the JSON generating invalid Immutable Maps so the Model component crashes when performing a .get("title").

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