swagger-api / swagger-api/swagger-ui
Array model name shown incorrectly
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{...}]

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

This is reproducible by pasting the content above onto https://editor.swagger.io
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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