Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

⚒️ Redocly CLI makes OpenAPI easy. Lint/validate to any standard, generate beautiful docs, and more.

License

NotificationsYou must be signed in to change notification settings

Redocly/redocly-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@Redocly CLI is your all-in-one OpenAPI utility.It builds, manages, improves, and quality-checks your OpenAPI descriptions, all of which comes in handy for various phases of the API Lifecycle.Create your own rulesets to make API governance easy, publish beautiful API reference documentation, and more.Supports OpenAPI 3.1, 3.0 and OpenAPI 2.0 (legacy Swagger), AsyncAPI 3.0 and 2.6, Arazzo 1.0.

build and testnpm (scoped)NPM

OpenAPI CLI toolset

Usage

Node

npx @redocly/cli lint path-to-root-file.yaml

Alternatively, install it globally withnpm:

npm install @redocly/cli -g

Then you can use it asredocly [command] [options], for example:

redocly lint path-to-root-file.yaml

The minimum required versions of Node.js and NPM are 18.17.0 and 10.8.2 respectively.

Docker

To give the Docker container access to the OpenAPI description files, you need to mount the containing directory as a volume.Assuming the API description is rooted in the current working directory, you need the following command:

docker run --rm -v$PWD:/spec redocly/cli lint path-to-root-file.yaml

To build and run with a local image, run the following from the project root:

docker build -t redocly/cli.docker run --rm -v$PWD:/spec redocly/cli lint path-to-root-file.yaml

Common tasks

Generate API reference documentation

Redocly CLI is a great way to render API reference documentation.It uses open sourceRedoc to build your documentation.Use a command like this:

redocly build-docs openapi.yaml

Your API reference docs are inredoc-static.html by default.You can customize this in many ways.Read the main docs for more information.

💡 Redocly also hashosted API management solution, a (commercial) alternative to Redoc.Redoc, Revel, Reef, and Realm can be worked on locally using thepreview command.

Bundle multiple OpenAPI documents

Having one massive OpenAPI description can be annoying, so most people split them up into multiple documents via$ref, only to later find out some tools don't support$ref or don't support multiple documents.Redocly CLI to the rescue! It has abundle command you can use to recombine all of those documents back into one single document.The bundled output that Redocly CLI provides is clean, tidy, and looks like a human made it.

Automate API guidelines with Linting

Check that your API matches the expected API guidelines by using thelint command.API guidelines are an important piece of API governance. They help to keep APIs consistent by enforcing the same standards and naming conventions, and they can also guide API teams through potential security hazards and other pitfalls.Automating API guidelines means you can keep APIs consistent and secure throughout their lifecycle.Even better, you can shape the design of the API before it even exists by combining API linting with a design-first API workflow.

Our API linter is designed for speed on even large documents, and it's easy to run locally, in CI, or anywhere you need it.It's also designed for humans, with meaningful error messages to help you get your API right every time.

Try it like this:

redocly lint openapi.yaml

Configure the rules as you wish.Other API Linters use complicated identifiers like JSONPath, but Redocly makes life easy with simple expressions that understand the OpenAPI structure.You can either use thebuilt-in rules to mix-and-match your ideal API guidelines, or break out the tools to build your own.

Format the output in whatever way you need.Thestylish output is as good as it sounds, but if you need JSON, Markdown, Checkstyle and other outputs to integrate with other tools, thelint command can output those too.

Multiple files supported so you don't need to bundle your API description to lint it; just point Redocly CLI at the "entry point" (e.g.:openapi.yaml) and it handles the rest.

Learn more about API standards and configuring Redocly rules.

Transform an OpenAPI description

If your OpenAPI description isn't everything you hoped it would be, enhance it with the Redoclydecorators feature.This allows you to:

  • Publish reference docs with a subset of endpoints for public use
  • Improve the docs by adding examples and descriptions
  • Adapt an existing OpenAPI description, and replace details like URLs for use on staging platforms

Data collection

This toolcollects data to help Redocly improve our products and services.You can opt out by setting theREDOCLY_TELEMETRY environment variable tooff.

Update notifications

Redocly CLI checks for updates on startup.You can disable this by setting theREDOCLY_SUPPRESS_UPDATE_NOTICE environment variable totrue.

More resources

Read the detailed docs.

Credits

Thanks tographql-js andeslint for inspiration of the API description traversal approach and toSwagger,Spectral, andOAS-Kit for inspiring the recommended ruleset.

Development

Contributions are welcome!All the information you need is inCONTRIBUTING.md.


[8]ページ先頭

©2009-2025 Movatter.jp