11

I'm new to the OpenAPI 3.0.0.

I have successfully created a java client library using an openapi-generator.

But OpenAPI Generator allows the generation of API client libraries (SDK generation), server stubs, documentation. So I want to know is there any commands or steps are available to generate HTML documentation and also to customize the documentation template.

3
  • Are you talking about Swagger documentation ? Open api document itself is used by Swagger UI or Redoc. Commented Jan 14, 2020 at 3:58
  • Yes. My use case is the openapi-generator has to create an API documentation in HTML. So that I can host that file in our web application. Is that possible ? Commented Jan 14, 2020 at 5:50
  • Definitely just google for 'open api tool chain for xyz'. There are toolchain that will be integrated with your code to host UI. If you want to customize the same , you can download UI source e.g. SwaggerUI , and integrate into your toolchain Commented Jan 15, 2020 at 17:16

1 Answer 1

27

Old question, but for those still bumping into it. OpenApi Generator can do generation of html documentation from your yaml or json definition of your API.

openapi-generator generate -i PathToMyInputDefinitionFile.yaml -g html -o /PathToOutputFolder

Where html is the generator you want to use. Other generators include dynamic-html and html2. Also can emit as markdown. See https://openapi-generator.tech/docs/generators/

If using Docker, a full example would look like this:

docker run --rm -v ${PWD}:/local openapitools/openapi-generator:tagname generate -i /local/input.yaml -g html -o /local

PWD is present working directory (current directory) in the host, which you are mapping on to /local in the container. Adjust 'tagname' to suit, from https://hub.docker.com/r/openapitools/openapi-generator/tags Adjust input.yaml to be your input file yaml definition of your API.

Sign up to request clarification or add additional context in comments.

2 Comments

Do you know if openapi-generator can be used programmatically ? That is, from Java to read an input.yml and produce the html2 pages?
The command was changed to openapi-generator-cli.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.