swagger-api / swagger-api/swagger-codegen

swagger-codegen -l html2 does not include enums if object is using inheritance and the field is missing description

Open
#5,331 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Client: HTML Feature: Composition / Inheritance Feature: Enum Issue: Bug
Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

swagger-codegen -l html2 does not include enums if object is using inheritance and the field is missing description

Swagger-codegen version

current master; HEAD = 5de04fa6129fd22ddd32b0d03d17b1d82397d66e

Swagger declaration file content or url
swagger: '2.0'

info:
  title: "sscce"
  version: '1.0'
  description: sscce

definitions:
  Bar:
    type: object
    properties:
      bar:
        type: string

  Foo:
    allOf:
      - $ref: "#/definitions/Bar"
      - type: object
        properties:
          foo:
            type: string
            enum:
              - qux
              - quux

paths:
  /foo:
    post:
      parameters:
        - name: foo
          in: body
          schema: {$ref: "#/definitions/Foo"}
      responses:
        "200":
          description: foo
          type: string
Command line used for generation

JAR=".../swagger-codegen.git/modules/swagger-codegen-cli/target/swagger-codegen-cli.jar"
java -jar "${JAR}" generate -i ~/sscce.yaml -l html2 -o foo

In the result, the Foo.foo enum is not rendered. If you either remove inheritance or add description to Foo.foo, the enums are rendered again.

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 supplied YAML with the swagger-codegen CLI using the html2 generator, then compare output with and without inheritance or a field description. Trace the html2 generation path and confirm completion when the Foo.foo enum values are rendered in the generated documentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi
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.