2018-03-17 20:56:08 +03:00
< div align = "center" >
2022-09-12 19:28:47 +03:00
< img alt = "Redoc logo" src = "https://raw.githubusercontent.com/Redocly/redoc/main//docs/images/redoc.png" width = "400px" / >
2016-07-28 20:17:56 +03:00
2024-01-29 19:39:44 +03:00
# Generate beautiful API documentation from OpenAPI
2016-01-17 23:19:34 +03:00
2023-09-21 17:19:27 +03:00
[![npm ](http://img.shields.io/npm/v/redoc.svg )](https://www.npmjs.com/package/redoc) [![License ](https://img.shields.io/npm/l/redoc.svg )](https://github.com/Redocly/redoc/blob/main/LICENSE)
2016-11-02 14:57:49 +03:00
2024-01-29 19:39:44 +03:00
[![bundle size ](http://img.badgesize.io/https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js?compression=gzip&max=300000 )](https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js) [![npm ](https://img.shields.io/npm/dm/redoc.svg )](https://www.npmjs.com/package/redoc) [![jsDelivr status ](https://data.jsdelivr.com/v1/package/npm/redoc/badge )](https://www.jsdelivr.com/package/npm/redoc)
2018-03-21 18:32:28 +03:00
< / div >
2016-07-28 19:58:04 +03:00
2017-10-12 00:01:37 +03:00
2021-09-13 04:41:29 +03:00
## About Redoc
2023-09-21 17:19:27 +03:00
Redoc is an open source tool for generating documentation from OpenAPI (formerly Swagger) definitions.
2021-09-23 05:17:19 +03:00
2021-12-09 16:27:31 +03:00
By default Redoc offers a three-panel, responsive layout:
2021-09-23 05:17:19 +03:00
- The left panel contains a search bar and navigation menu.
- The central panel contains the documentation.
- The right panel contains request and response examples.
2021-09-13 04:41:29 +03:00
2022-09-12 19:28:47 +03:00
![Redoc demo ](https://raw.githubusercontent.com/Redocly/redoc/main/demo/redoc-demo.png )
2016-07-28 19:58:04 +03:00
2021-09-13 04:41:29 +03:00
## Live demo
2023-07-11 20:31:52 +03:00
If you want to see how Redoc renders your OpenAPI definition,
2021-09-13 04:41:29 +03:00
you can try it out online at https://redocly.github.io/redoc/.
A version of the Swagger Petstore API is displayed by default.
To test it with your own OpenAPI definition,
enter the URL for your definition and select **TRY IT** .
2023-09-21 17:19:27 +03:00
## Redoc features
2021-10-09 21:40:39 +03:00
2021-09-13 04:41:29 +03:00
- Responsive three-panel design with menu/scrolling synchronization
2023-09-21 17:19:27 +03:00
- Support for OpenAPI 3.1, OpenAPI 3.0, and Swagger 2.0
2021-09-13 04:41:29 +03:00
- Ability to integrate your API introduction into the side menu
2023-09-21 17:19:27 +03:00
- High-level grouping in side menu with the [`x-tagGroups` ](https://redocly.com/docs/api-reference-docs/specification-extensions/x-tag-groups/ ) specification extension
2022-10-12 15:28:08 +03:00
- [Simple integration with `create-react-app` ](https://redocly.com/docs/redoc/quickstart/react/ )
2023-09-21 17:19:27 +03:00
- Code samples support (with vendor extension) < br >
2024-01-29 19:39:44 +03:00
![code samples in action ](docs/images/code-samples-demo.gif )
2016-07-28 19:58:04 +03:00
2023-09-21 17:19:27 +03:00
## Usage
2017-11-23 12:57:07 +03:00
2023-09-21 17:19:27 +03:00
Redoc is provided as a CLI tool (also distributed as a Docker image), HTML tag, and React component.
2016-07-28 19:58:04 +03:00
2023-09-21 17:19:27 +03:00
### Generate documentation from the CLI
2017-09-11 22:10:37 +03:00
2023-09-21 17:19:27 +03:00
If you have Node installed, quickly generate documentation using `npx` :
2021-10-09 21:40:39 +03:00
2024-01-29 19:39:44 +03:00
```bash
2023-09-21 17:19:27 +03:00
npx @redocly/cli build-docs openapi.yaml
```
2021-10-09 21:40:39 +03:00
2023-09-21 17:19:27 +03:00
The tool outputs by default to a file named `redoc-static.html` that you can open in your browser.
2021-10-09 21:40:39 +03:00
2023-09-21 17:19:27 +03:00
> [Redocly CLI](https://github.com/Redocly/redocly-cli/) does more than docs; check it out and add linting, bundling, and more to your API workflow.
2021-09-13 04:41:29 +03:00
2023-09-21 17:19:27 +03:00
### Add an HTML element to the page
2021-09-13 04:41:29 +03:00
2023-09-21 17:19:27 +03:00
Create an HTML page, or edit an existing one, and add the following within the body tags:
2021-09-13 14:22:18 +03:00
2021-09-13 04:41:29 +03:00
```html
2023-09-21 17:19:27 +03:00
< redoc spec-url = "http://petstore.swagger.io/v2/swagger.json" > < / redoc >
2022-05-30 13:40:19 +03:00
< script src = "https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js" > < / script >
2021-09-13 04:41:29 +03:00
```
2023-09-21 17:19:27 +03:00
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. The JavaScript library can also be installed locally using `npm` and served from your own server, see the [HTML deployment documentation ](https://redocly.com/docs/redoc/deployment/html/ ) for more details.
### More usage options
2023-11-13 14:48:58 +03:00
Check out the [deployment documentation ](./docs/deployment/intro.md ) for more options, and detailed documentation for each.
2023-09-21 17:19:27 +03:00
2023-12-01 19:00:50 +03:00
## Redoc vs. Redocly API Reference
2023-09-21 17:19:27 +03:00
Redoc is Redocly's community-edition product. Looking for something more?
We also offer [hosted API reference documentation ](https://redocly.com/docs/api-registry/guides/api-registry-quickstart/ )
with additional features including:
* Try-it console
* Automated code samples
* Pagination
* Extra theme options
2018-06-25 13:56:52 +03:00
2023-09-21 17:19:27 +03:00
### Documentation and resources
- [Reference docs ](https://redocly.com/docs/api-reference-docs/getting-started/ ) - we take care of the hosting
- [Redoc ](https://redocly.com/docs/redoc/ ) - detailed documentation for this open source project (also in the `docs/` folder)
- [Command-line interface to bundle your docs into a web-ready HTML file ](https://redocly.com/docs/cli/commands/build-docs/ )
- API linting, bundling, and much more with open source [Redocly CLI ](https://redocly.com/docs/cli )
## Showcase
A sample of the organizations using Redocly tools in the wild:
- [Rebilly ](https://api-reference.rebilly.com/ )
- [Docker Engine ](https://docs.docker.com/engine/api/v1.25/ )
- [Zuora ](https://www.zuora.com/developer/api-reference/ )
- [Discourse ](http://docs.discourse.org )
- [Commbox ](https://www.commbox.io/api/ )
- [APIs.guru ](https://apis.guru/api-doc/ )
- [BoxKnight ](https://www.docs.boxknight.com/ )
2023-12-28 18:38:40 +03:00
- [Quaderno API ](https://developers.quaderno.io/api )
2023-09-21 17:19:27 +03:00
_Pull requests to add your own API page to the list are welcome_
2021-11-23 08:07:56 +03:00
2016-01-25 00:15:50 +03:00
## Configuration
2023-09-21 17:19:27 +03:00
Redoc is highly configurable, see the [configuration documentation ](docs/config.md ) for details.
2016-10-31 13:32:17 +03:00
2021-09-01 14:48:46 +03:00
### OpenAPI specification extensions
2022-05-10 01:53:40 +03:00
Redoc uses the following [specification extensions ](https://redocly.com/docs/api-reference-docs/spec-extensions/ ):
2023-09-21 17:19:27 +03:00
2016-02-01 20:23:13 +03:00
* [`x-logo` ](docs/redoc-vendor-extensions.md#x-logo ) - is used to specify API logo
2023-09-21 17:19:27 +03:00
* [`x-traitTag` ](docs/redoc-vendor-extensions.md#x-traitTag ) - useful for tags that refer to non-navigation properties like Pagination, Rate-Limits, etc
2020-05-10 22:11:01 +03:00
* [`x-codeSamples` ](docs/redoc-vendor-extensions.md#x-codeSamples ) - specify operation code samples
2017-03-09 13:55:23 +03:00
* [`x-examples` ](docs/redoc-vendor-extensions.md#x-examples ) - specify JSON example for requests
2019-12-10 09:03:46 +03:00
* [`x-nullable` ](docs/redoc-vendor-extensions.md#x-nullable ) - mark schema param as a nullable
2016-12-11 23:57:22 +03:00
* [`x-displayName` ](docs/redoc-vendor-extensions.md#x-displayname ) - specify human-friendly names for the menu categories
2016-12-26 00:47:33 +03:00
* [`x-tagGroups` ](docs/redoc-vendor-extensions.md#x-tagGroups ) - group tags by categories in the side menu
2017-02-26 00:44:19 +03:00
* [`x-servers` ](docs/redoc-vendor-extensions.md#x-servers ) - ability to specify different servers for API (backported from OpenAPI 3.0)
2017-09-21 01:18:38 +03:00
* [`x-ignoredHeaderParameters` ](docs/redoc-vendor-extensions.md#x-ignoredHeaderParameters ) - ability to specify header parameter names to ignore
2019-06-18 11:41:48 +03:00
* [`x-additionalPropertiesName` ](docs/redoc-vendor-extensions.md#x-additionalPropertiesName ) - ability to supply a descriptive name for the additional property keys
2023-09-21 17:19:27 +03:00
* [`x-summary` ](docs/redoc-vendor-extensions.md#x-summary ) - for Response object, use as the response button text, with description rendered under the button
* [`x-extendedDiscriminator` ](docs/redoc-vendor-extensions.md#x-extendedDiscriminator ) - in Schemas, uses this to solve name-clash issues with the standard discriminator
* [`x-explicitMappingOnly` ](docs/redoc-vendor-extensions.md#x-explicitMappingOnly ) - in Schemas, display a more descriptive property name in objects with additionalProperties when viewing the property list with an object
## Releases
**The README for the `1.x` version is on the [v1.x ](https://github.com/Redocly/redoc/tree/v1.x ) branch.**
All the 2.x releases are deployed to npm and can be used with Redocly-cdn:
- particular release, for example, `v2.0.0` : https://cdn.redoc.ly/redoc/v2.0.0/bundles/redoc.standalone.js
- `latest` release: https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js
Additionally, all the 1.x releases are hosted on our GitHub Pages-based CDN ** (deprecated)**:
- particular release, for example `v1.2.0` : https://rebilly.github.io/ReDoc/releases/v1.2.0/redoc.min.js
- `v1.x.x` release: https://rebilly.github.io/ReDoc/releases/v1.x.x/redoc.min.js
- `latest` release: https://rebilly.github.io/ReDoc/releases/latest/redoc.min.js - points to latest 1.x.x release since 2.x releases are not hosted on this CDN but on unpkg.
2016-08-23 01:04:10 +03:00
## Development
2018-10-03 10:02:30 +03:00
see [CONTRIBUTING.md ](.github/CONTRIBUTING.md )