swagger-api/swagger-codegen

swagger-codegen -l html2 would be much nicer looking if it treated inheritance as in programming language doc generators

Open

#5,166 opened on 2017年3月22日

GitHub で見る
 (0 comments) (2 reactions) (0 assignees)HTML (12,701 stars) (5,474 forks)batch import
Client: HTMLGeneral: Suggestionhelp wanted

説明

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:

actual

which would be much nicer as

desired

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.

コントリビューターガイド