swagger-api / swagger-ui

Swagger UI is a collection of HTML, JavaScript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API.
https://swagger.io
Apache License 2.0
26.67k stars 8.97k forks source link

Array model name shown incorrectly #5276

Open xdrop opened 5 years ago

xdrop commented 5 years ago

Consider this representation:

basePath: /
consumes:
- application/json
definitions:
  Domain:
    description: |-
      An example domain
    properties:
      id:
        type: string
      name:
        type: string
    type: object
  domainsList:
    description: A list of all domains
    items:
      $ref: '#/definitions/Domain'
    type: array
info:
  description: This documentation describes example APIs
  license:
    name: MIT
  title: Example
  version: 1.0.0
paths:
  /domain:
    get:
      operationId: domains
      responses:
        "200":
          description: A list of all domains
          schema:
            $ref: '#/definitions/domainsList'
      summary: Get all domains
produces:
- application/json
responses:
  ok:
    description: The response type of a call to get all domains
schemes:
- https
securityDefinitions:
  bearer:
    in: header
    name: Authorization
    type: apiKey
swagger: "2.0"

domainsList is of type array with items of type #/definitions/Domain. However when shown in the Models section this is rendered incorrectly:

Expected

A list of Domain ie. [Domain{...}]

Screenshot 2019-03-29 at 21 05 24

Actual

The name of the object is incorrectly shown as the name of the list

Screenshot 2019-03-29 at 21 04 28

This is reproducible by pasting the content above onto https://editor.swagger.io

caffeinatedMike commented 9 months ago

2024 and this is still an issue. @xdrop Any reason why you closed the fix PR?