redoc README

README проекта с github.com/Redocly/redoc. Одним файлом markdown: README.md.

Learn what's new in Redoc 3.x → Redoc 3.x migration guide →

Generate beautiful API documentation from OpenAPI, AsyncAPI, and GraphQL

npm License

npm jsDelivr status

About Redoc

Redoc is an open source tool for generating documentation from OpenAPI (formerly Swagger), AsyncAPI, and GraphQL definitions.

By default Redoc offers a three-panel, responsive layout:

Redoc demo

Live demo

If you want to see how Redoc renders your API definition, you can try it out online at https://redocly.github.io/redoc/.

A version of the Redocly Cafe API is displayed by default. To test it with your own API definition, enter the URL for your definition and select TRY IT.

Redoc features

Usage

Redoc Community Edition is available as an HTML tag, a React component, and via the Redocly CLI (also distributed as a Docker image).

Generate documentation from the CLI

If you have Node installed, quickly generate documentation using npx:

npx @redocly/cli build-docs openapi.yaml

The tool outputs by default to a file named redoc-static.html that you can open in your browser.

Redocly CLI does more than docs; check it out and add linting, bundling, and more to your API workflow.

Add an HTML element to the page

Create an HTML page, or edit an existing one, and add the following within the body tags:

    <redoc spec-url="https://example.com/openapi.yaml"></redoc>
    <script type="module" src="https://cdn.redoc.ly/redoc/v3.x/bundles/redoc.standalone.js"> </script>

Open the HTML file in your browser, and your API documentation is shown on the page.

Add your own spec-url to the <redoc> tag; this attribute can also be a local file, an AsyncAPI definition, or a GraphQL schema. The JavaScript library can also be installed locally using npm and served from your own server, see the HTML deployment documentation for more details.

Use the React component

import { RedocStandalone } from 'redoc';

<RedocStandalone specUrl="https://example.com/openapi.yaml" />;

More usage options

Check out the deployment documentation for more options, and detailed documentation for each.

Redoc vs. hosted Redoc

Redoc is Redocly's community-edition product. Looking for something more? We also offer Redoc with support for specifications like SOAP and additional features including:

Documentation and resources

Showcase

A sample of the organizations using Redocly tools in the wild:

Pull requests to add your own API page to the list are welcome

Configuration

Redoc is highly configurable, see the configuration documentation for details.

OpenAPI specification extensions

Redoc uses the following specification extensions:

Examples

Runnable, copy-ready projects for common setups live in examples/: plain HTML, React, Next.js, Vue, Svelte, Angular, Express, NestJS, FastAPI, ASP.NET Core, Spring Boot, Laravel, and framework-free Java, Go, Rust, PHP and Python. Each one is built and smoke-tested against the local build on every pull request; see examples/README.md for the contract and how to add one.

Two deliveries have nothing to copy and are documented rather than built: examples/docker for the official redocly/redoc image and examples/cli for redocly build-docs.

Releases

The README for the 1.x version is on the v1.x branch.

The README for the 2.x version is on the v2.x branch.

All the 2.x and 3.x releases are deployed to npm and can be used with Redocly-cdn:

Additionally, all the 1.x releases are hosted on our GitHub Pages-based CDN (deprecated):

Telemetry

Redoc collects anonymous usage and performance data to help prioritize work. It never sends your API definition content or personal information. Opt out with disable-telemetry="true" on the <redoc> tag, disableTelemetry: true in options. See the telemetry documentation for details.

Development

see CONTRIBUTING.md

redoc (Redocly/redoc)

Ищем в базе…

Что это такое?Redoc — это open-source инструмент, который генерирует справочную документацию по API из определений OpenAPI (ранее Swagger). Он превращает ваш spec-файл в аккуратную и удобную для чтения справочную страницу.
Как выглядит сгенерированная документация?Это веб-страница из трёх панелей, которая адаптируется под размер экрана: слева строка поиска и меню навигации, в центре сама документация, а справа примеры запросов и ответов.
Как сгенерировать документацию из моего spec-файла?Когда Node установлен, запустите Redocly CLI через npx, указав своё определение OpenAPI — на выходе получится файл redoc-static.html, который можно сразу открыть в браузере.
Для этого нужен Node?Для варианта с CLI нужен Node. Если не хочется его настраивать, есть Docker-образ, HTML-тег, который можно вставить в любую страницу, и React-компонент для интеграции в приложение.
Чего я лишаюсь, используя это вместо облачного продукта Redocly?Redoc — это версия для сообщества. Платная облачная версия дополнительно даёт консоль для тестирования запросов, автоматическую генерацию примеров кода, полностью настраиваемые стили, mock-сервер, а также поддержку AsyncAPI и GraphQL.
Какие форматы описания API он принимает?Поддерживаются OpenAPI 3.1, OpenAPI 3.0 и устаревший Swagger 2.0, так что старые Swagger-спецификации работают без конвертации.
Можно посмотреть документацию, ничего не устанавливая?Да — есть онлайн-демо, которое по умолчанию показывает пример API Petstore; введите URL своего определения OpenAPI и нажмите TRY IT, чтобы увидеть, как Redoc его отрисует.
CLI годится только для генерации HTML-файла?Нет — Redocly CLI также умеет делать линтинг и объединение (бандлинг) ваших OpenAPI-файлов, так что генерацию документации можно встроить в более широкий процесс работы с API.
Кто реально пользуется Redoc?В витрине проектов среди пользователей инструментов Redocly перечислены такие организации, как Docker Engine, Zuora, Discourse, Rebilly, APIs.guru и Quaderno API.
Какие есть похожие проекты?swagger-ui, swag, forge, swagger-codegen, nimbus, vibex, openapi-generator, scalar
Автор
Redocly
Размер
105.2 MB
Звёзды
26K
Возраст
11 г
Коммиты · 90 дней