swagger-api / swagger-codegen

swagger-codegen contains a template-driven engine to generate documentation, API clients and server stubs in different languages by parsing your OpenAPI / Swagger definition.
http://swagger.io
Apache License 2.0
16.98k stars 6.03k forks source link

generated HTML contains invalid anchor links #5087

Open jan-matejka opened 7 years ago

jan-matejka commented 7 years ago
Description

generated HTML contains invalid anchor links on types of request parameters

Swagger-codegen version

current master; HEAD = 1c160df33897898da1c39f230c737eb6a313e6ba

Swagger declaration file content or url
swagger: "2.0"

info:
  title: swagger-codegen broken anchors to models
  version: '1.0'

definitions:
  foo:
    type: object
    properties:
      x:
        type: string

paths:
  /foo:
    get:
      parameters:
        - name: foo
          in: body
          description: foo
          schema: {$ref: "#/definitions/foo"}
      responses:
        "200":
          description: foo
          type: null
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 html -o foo

Note in the generated html the link's first letter is capital while the anchor is not. Using Firefox 51.0.1 (64-bit)

wing328 commented 7 years ago

@yaccz thanks for reporting the issue. May I know if you've time to contribute a fix? If yes, I can show you some good starting points.

html2 is another documentation generator worth trying.

jan-matejka commented 7 years ago

I'm switching to html2. Maybe the documentation [1]_ should be updated. Thanks.

.. [1] https://github.com/swagger-api/swagger-codegen#generating-static-html-api-documentation

wing328 commented 7 years ago

@yaccz yup, please feel free to send a PR to update the README about html2

jan-matejka commented 7 years ago

Is there a way to display all possible target formats? I couldn't find it using

JAR=".../swagger-codegen.git/modules/swagger-codegen-cli/target/swagger-codegen-cli.jar"
java -jar "${JAR}"  help generate

or how can I get that information?

wing328 commented 7 years ago

Please run java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar config-help -l xyz it will show an error and display a list of possible targets.