{"id":13539982,"url":"https://github.com/Redocly/redocly-cli","last_synced_at":"2025-04-02T06:31:56.278Z","repository":{"id":37084864,"uuid":"207588519","full_name":"Redocly/redocly-cli","owner":"Redocly","description":"⚒️ Redocly CLI makes OpenAPI easy. Lint/validate to any standard, generate beautiful docs, and more.","archived":false,"fork":false,"pushed_at":"2024-10-29T09:29:38.000Z","size":26739,"stargazers_count":932,"open_issues_count":177,"forks_count":146,"subscribers_count":29,"default_branch":"main","last_synced_at":"2024-10-29T11:17:09.615Z","etag":null,"topics":["api-governance","cicd","linter","openapi","openapi-cli","openapi3","openapi31","redoc","redocly","swagger2"],"latest_commit_sha":null,"homepage":"https://redocly.com/docs/cli/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Redocly.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-10T14:56:25.000Z","updated_at":"2024-10-28T17:30:23.000Z","dependencies_parsed_at":"2024-01-16T12:25:12.413Z","dependency_job_id":"9fc76cf0-a94c-458c-b59c-09cc9dc9c45b","html_url":"https://github.com/Redocly/redocly-cli","commit_stats":{"total_commits":1441,"total_committers":117,"mean_commits":"12.316239316239317","dds":0.7536433032616239,"last_synced_commit":"ebbcddc832b0c4fb800703671d0ca0f0efff32e9"},"previous_names":["redocly/openapi-cli"],"tags_count":289,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Redocly%2Fredocly-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Redocly%2Fredocly-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Redocly%2Fredocly-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Redocly%2Fredocly-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Redocly","download_url":"https://codeload.github.com/Redocly/redocly-cli/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246176345,"owners_count":20735753,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-governance","cicd","linter","openapi","openapi-cli","openapi3","openapi31","redoc","redocly","swagger2"],"created_at":"2024-08-01T09:01:36.369Z","updated_at":"2025-04-02T06:31:56.268Z","avatar_url":"https://github.com/Redocly.png","language":"TypeScript","funding_links":[],"categories":["TypeScript","others"],"sub_categories":[],"readme":"# Redocly CLI\n\n[@Redocly](https://redocly.com) CLI is your all-in-one OpenAPI utility.\nIt builds, manages, improves, and quality-checks your OpenAPI descriptions, all of which comes in handy for various phases of the API Lifecycle.\nCreate your own rulesets to make API governance easy, publish beautiful API reference documentation, and more.\nSupports OpenAPI 3.1, 3.0 and OpenAPI 2.0 (legacy Swagger), AsyncAPI 3.0 and 2.6, Arazzo 1.0.\n\n![build and test](https://github.com/redocly/redocly-cli/actions/workflows/tests.yaml/badge.svg)\n![npm (scoped)](https://img.shields.io/npm/v/@redocly/cli)\n![NPM](https://img.shields.io/npm/l/@redocly/cli)\n\n![OpenAPI CLI toolset](./media/redocly-cli.gif)\n\n## Usage\n\n### Node\n\n```sh\nnpx @redocly/cli@latest lint path-to-root-file.yaml\n```\n\nAlternatively, install it globally with `npm`:\n\n```sh\nnpm install @redocly/cli -g\n```\n\nThen you can use it as `redocly [command] [options]`, for example:\n\n```sh\nredocly lint path-to-root-file.yaml\n```\n\nThe minimum required versions of Node.js and NPM are 18.17.0 and 10.8.2 respectively.\n\n### Docker\n\nTo give the Docker container access to the OpenAPI description files, you need to mount the containing directory as a volume.\nAssuming the API description is rooted in the current working directory, you need the following command:\n\n```sh\ndocker run --rm -v $PWD:/spec redocly/cli lint path-to-root-file.yaml\n```\n\nTo build and run with a local image, run the following from the project root:\n\n```sh\ndocker build -t redocly/cli .\ndocker run --rm -v $PWD:/spec redocly/cli lint path-to-root-file.yaml\n```\n\n## Common tasks\n\n### Generate API reference documentation\n\nRedocly CLI is a great way to render API reference documentation.\nIt uses open source [Redoc](https://github.com/redocly/redoc) to build your documentation.\nUse a command like this:\n\n```sh\nredocly build-docs openapi.yaml\n```\n\nYour API reference docs are in `redoc-static.html` by default.\nYou can customize this in many ways.\n[Read the main docs](https://redocly.com/docs/cli/commands/build-docs) for more information.\n\n\u003e :bulb: Redocly also has [hosted API management solution](https://redocly.com/reunite/), a (commercial) alternative to Redoc.\n\u003e Redoc, Revel, Reef, and Realm can be worked on locally using the `preview` command.\n\n### Bundle multiple OpenAPI documents\n\nHaving 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.\nRedocly CLI to the rescue! It has a `bundle` command you can use to recombine all of those documents back into one single document.\nThe bundled output that Redocly CLI provides is clean, tidy, and looks like a human made it.\n\n### Automate API guidelines with Linting\n\nCheck that your API matches the expected API guidelines by using the `lint` command.\nAPI 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.\nAutomating API guidelines means you can keep APIs consistent and secure throughout their lifecycle.\nEven better, you can shape the design of the API before it even exists by combining API linting with a design-first API workflow.\n\nOur API linter is designed for speed on even large documents, and it's easy to run locally, in CI, or anywhere you need it.\nIt's also designed for humans, with meaningful error messages to help you get your API right every time.\n\nTry it like this:\n\n```sh\nredocly lint openapi.yaml\n```\n\n**Configure the rules** as you wish.\nOther API Linters use complicated identifiers like JSONPath, but Redocly makes life easy with simple expressions that understand the OpenAPI structure.\nYou can either use the [built-in rules](https://redocly.com/docs/cli/rules) to mix-and-match your ideal API guidelines, or break out the tools to build your own.\n\n**Format the output** in whatever way you need.\nThe `stylish` output is as good as it sounds, but if you need JSON, Markdown, Checkstyle and other outputs to integrate with other tools, the `lint` command can output those too.\n\n**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.\n\n[Learn more about API standards and configuring Redocly rules](https://redocly.com/docs/cli/api-standards).\n\n### Transform an OpenAPI description\n\nIf your OpenAPI description isn't everything you hoped it would be, enhance it with the Redocly [decorators](https://redocly.com/docs/cli/decorators) feature.\nThis allows you to:\n\n- Publish reference docs with a subset of endpoints for public use\n- Improve the docs by adding examples and descriptions\n- Adapt an existing OpenAPI description, and replace details like URLs for use on staging platforms\n\n## Data collection\n\nThis tool [collects data](./docs/usage-data.md) to help Redocly improve our products and services.\nYou can opt out by setting the `REDOCLY_TELEMETRY` environment variable to `off`.\n\n## Update notifications\n\nRedocly CLI checks for updates on startup.\nYou can disable this by setting the `REDOCLY_SUPPRESS_UPDATE_NOTICE` environment variable to `true`.\n\n## More resources\n\n[Read the detailed docs](https://redocly.com/docs/cli/).\n\n## Credits\n\nThanks to [graphql-js](https://github.com/graphql/graphql-js) and [eslint](https://github.com/eslint/eslint) for inspiration of the API description traversal approach and to [Swagger](https://github.com/swagger-api/swagger-editor), [Spectral](https://github.com/stoplightio/spectral), and [OAS-Kit](https://github.com/Mermade/oas-kit) for inspiring the recommended ruleset.\n\n## Development\n\nContributions are welcome!\nAll the information you need is in [CONTRIBUTING.md](CONTRIBUTING.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRedocly%2Fredocly-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FRedocly%2Fredocly-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRedocly%2Fredocly-cli/lists"}