swagger-api / swagger-api/swagger-codegen
swagger-codegen -l html2 would be much nicer looking if it treated inheritance as in programming language doc generators
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
swagger-codegen -l html2 would be much nicer looking if it treated inheritance as in programming language doc generators
Swagger declaration file content or url
swagger: '2.0'
info:
title: "sscce"
version: '1.0'
description: sscce
definitions:
Animal:
type: object
properties:
number_of_legs:
type: integer
Pet:
allOf:
- $ref: "#/definitions/Animal"
- type: object
properties:
name:
type: string
Cat:
allOf:
- $ref: "#/definitions/Pet"
- type: object
properties:
likes_water:
type: boolean
paths:
/foo:
post:
parameters:
- name: cat
in: body
schema: {$ref: "#/definitions/Cat"}
responses:
"200":
description: foo
type: string
Swagger-codegen version
current master; HEAD = 1c160df33897898da1c39f230c737eb6a313e6ba
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
Renders as:

which would be much nicer as

The pic is not that descriptive but I assume you know what you are looking at since swagger-codegen is written in java.
My first issue is with the indenting which by the shape of it looks more like composition and second is with the copy-paste use of allOf which will not be obvious to a person unfamiliar with the OpenAPI spec format itself.
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 html2 generation command with the supplied Swagger YAML and compare the actual and desired renders. Start at the html2 generator and its templates, then define how the Animal, Pet, and Cat inheritance hierarchy should be shown; done means inheritance is presented as a hierarchy rather than repeated allOf content.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- documentation
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100