swagger-api / swagger-api/swagger-codegen

[HTML] Definition with array of definition objects does not generate property

Open
#7,740 1 comment 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

When creating a definition which is an array whose items are another definition, the generated static HTML file lists nothing under the array-typed definition.

Swagger-codegen version

2.2.1

Swagger declaration file content or url
swagger: '2.0'
definitions:
  Foo:
    type: array
    items:
      $ref: '#/definitions/Bar'
  Bar:
    type: object
    properties:
      blah:
        type: string
Command line used for generation

java -jar swagger-codegen-cli.jar generate -i swagger.yaml -l html

Steps to reproduce
  • Have a definition which is an array whose items are a $ref to another definition
  • Generate static HTML docs with -l html
  • Observe generated index.html contains an empty definition for the array-typed definition (Foo, in the above example)
Related issues/PRs

Possibly related to #6974

Suggest a fix/enhancement

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 with the supplied swagger.yaml definition and java -jar swagger-codegen-cli.jar generate -i swagger.yaml -l html, then inspect the generated index.html for Foo. Trace the HTML generator entry point and related templates or tests for array definitions. Done means Foo displays its referenced Bar properties instead of an empty definition.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
cli, 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.