Files
redocly-cli/docs/installation.md
Lorna Jane Mitchell fd79f7d4c5 docs: Use Museum API instead of Petstore examples (#1386)
* docs: add museum examples to installation and bundle/join commands

* docs: removed petstore examples and updated formatting for readability

* docs: Update petstore to museum examples in decorators section

* chore: Prettier wants to fix a file

* chore: Fix Vale-detected future tense mistakes

* Update docs/decorators/media-type-examples-override.md

* Update docs/commands/lint.md

* Update docs/commands/lint.md

---------

Co-authored-by: Heather Cloward <heathercloward@gmail.com>
2024-02-12 18:06:11 +00:00

2.5 KiB

Install Redocly CLI

Choose the most appropriate installation method for your needs:

Install globally

{% admonition type="success" name="Tip" %} Make sure you have the newest version of npm/yarn before you begin. {% /admonition %}

{% tabs %} {% tab label="npm" %}

npm i -g @redocly/cli@latest

{% /tab %} {% tab label="yarn" %}

yarn global add @redocly/cli

{% /tab %} {% /tabs %}

Running redocly --version confirms that the installation was successful, and the currently-installed version of the tool.

Use npx at runtime

npx is npm's package runner. It installs and runs a command without installing it globally. You might use this where you can't install a new command, or in a CI context where the command is only used a handful of times. {% tabs %} {% tab label="Command" %}

npx @redocly/cli <command> [options]

{% /tab %} {% tab label="Example with lint command" %}

npx @redocly/cli@latest lint openapi.yaml

{% /tab %} {% /tabs %}

Run commands inside Docker

Redocly CLI is available as a pre-built Docker image in Docker Hub and GitHub Packages.

Install Docker if you don't have it already, then pull the image with the following command: {% tabs %} {% tab label="Docker Hub" %}

docker pull redocly/cli

{% /tab %} {% tab label="GitHub Packages" %}

docker pull ghcr.io/redocly/cli

{% /tab %} {% /tabs %} To give a Docker container access to your OpenAPI description files, you need to mount the containing directory as a volume. Assuming the API description is in the current working directory, the command to use is:

docker run --rm -v $PWD:/spec redocly/cli lint openapi.yaml

Next steps