swagger-api / swagger-api/swagger-ui

Array model name shown incorrectly

Open
#5,276 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
29k
Forks
9.3k
Avg merge
2d 23h
Merged PRs (30d)
25

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue by pasting the provided OpenAPI definition into editor.swagger.io and viewing the Models section. Trace the model rendering entry point for the domainsList array, then verify that it displays an array of Domain objects rather than using the list name as the object name.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.