swagger-api / swagger-api/swagger-ui

All model properties wrapped into array

Open
#10,322 0 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

Q&A (please complete the following information)
  • OS: RockyLinux
  • Browser: Firefox/Chrome
  • Version: 128/132
  • Method of installation: npm
  • Swagger-UI version: 5.19
  • Swagger/OpenAPI version: swagger 2.0 & openAPI 3.0
Content & configuration

Reproducable with petstore.swagger

Describe the bug you're encountering

Why all properties are presented in an array even if they are not an array?

    "ApiResponse": {
      "type": "object",
      "properties": {
        "code": {
          "type": "integer",
          "format": "int32"
        },
        "type": {
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      }
    },
To reproduce...
const express = require("express");
const pathToSwaggerUi = require("swagger-ui-dist").absolutePath();

const app = express();

app.use(express.static(pathToSwaggerUi));

app.listen(3000);

Go to localhost:3000 and look at one model

Expected behavior

Expect to have properties not wrapped in an array

Screenshots

Image

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

Start by running the provided Express setup with swagger-ui-dist and reproduce the model view using petstore.swagger. Compare the displayed ApiResponse properties with the schema, and consider the issue complete when non-array properties are shown without array wrapping.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.