swagger-api / swagger-api/swagger-codegen

[HTML2] Undefined response schema when is of type array

Open
#7,714 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

API documentation generated used HTML2 language gives 'undefined' schema when it's of type array. To see the schema you need to wind and unwind it, as shown on photos.

image
image
image

Swagger-codegen version

2.3.1

Swagger declaration file content or url
     responses:
        200:
          description: "Some description"
          schema:
            type: "array"
            items:
              $ref: "#/definitions/SomeDefinition"
Command line used for generation
java -jar webservice/docs/swagger-codegen-cli.jar generate \
    -i webservice/swagger/swagger.yaml \
    -l html2 \
    -o webservice/docs/API_docs
Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement

I have 3 responses of array type and each one has this problem, returning response as object works fine, so I'm sure it's because of the array response

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 reproducing the issue with the provided Swagger schema and the swagger-codegen CLI command using the html2 generator. Inspect the generated API documentation and the HTML2 generation path for array response schemas. Done means array responses display their referenced schema immediately, without needing to collapse and expand the response.

Written by the indexing model from the issue text.

Assessment

Tech stack
html
Domain
documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.