最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

openapi - Generate offline docs for Swagger - Stack Overflow

programmeradmin2浏览0评论

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

  • I don't have access to JVM or Docker
  • It needs to be reliable (no online site that could shutdown in the future)

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 :

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

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

  • I don't have access to JVM or Docker
  • It needs to be reliable (no online site that could shutdown in the future)

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/a/46484079/15719786

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

Share Improve this question edited Nov 21, 2024 at 13:42 Jeremy Fiel 3,3072 gold badges11 silver badges26 bronze badges asked Nov 20, 2024 at 8:35 shined dayshined day 135 bronze badges 5
  • 1 What did you try? We would like to help you but we need details. This is not a wish come true site. – tukan Commented Nov 20, 2024 at 8:37
  • What's your question? – Guy Incognito Commented Nov 20, 2024 at 8:39
  • See if this helps: How to generate a PDF or markup from OpenAPI 3.0?, How to generate offline Swagger API docs?, Swagger UI single interactive HTML. Also check this list of OpenAPI renderers: openapi.tools/#documentation, some of them can be self-hosted and/or viewed locally (e.g. Redoc, RapiDoc, Widdershins). – Helen Commented Nov 20, 2024 at 11:20
  • Also what's your use case? Do you want to self-host the API docs on your own site? Or ship the API docs as part of on-premise product installations? Or something else? – Helen Commented Nov 20, 2024 at 11:24
  • 1 @Helen the goal is to provide a (hopefully) standalone, offline document, readable without any special tools (so HTML without imported script, PDF docx are fine) that provide similar information to swagger UI (endpoints, responses schemas, error code handlings...). My best attempt so far was to use stackoverflow/a/46484079/15719786 this python script -> open result in browser -> save as html -> this provides me 1 html with few other files (ccs and scripts) and work fine offline – shined day Commented Nov 20, 2024 at 15:06
Add a comment  | 

1 Answer 1

Reset to default 0

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/docs/cli/commands/build-docs

发布评论

评论列表(0)

  1. 暂无评论