openapiredocly

Generate offline docs for Swagger


I need to generate offline documentation (PDF / docx / Standalone html) for a Rest/Json api with a few constraint:

Few extra infos: it's Uvnicorn server (Python3.9) generating openapi (3.0.2) jsonschema

The goal is to provide 1 document, that provide similar informations as SwaggerUI (each endpoints, with http codes, responses schemas, examples)

This document need to provide readable information without any extra tools (e.g. pdf is fine), my best attempt so far was to use this : https://stackoverflow.com/a/46484079/15719786

But there's still a bunch of imported scripts and ccs that either need seperated files or to be online


Solution

  • You can use Redocly standalone html

    download Redocly cli npm package.

    npm install @redocly/cli:latest

    Use the build-docs command to create a standalone html file

    redocly build-docs <path/to/api> --output <filename.html>

    lots of other customizations you can do with this command with the theme and config options.

    src: https://redocly.com/docs/cli/commands/build-docs