@redocly/cli 0.0.0-snapshot.1739906995 → 0.0.0-snapshot.1739918020
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -16
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
# Redocly CLI
|
|
2
2
|
|
|
3
|
-
[@Redocly](https://redocly.com) CLI is your all-in-one OpenAPI utility.
|
|
3
|
+
[@Redocly](https://redocly.com) CLI is your all-in-one OpenAPI utility.
|
|
4
|
+
It builds, manages, improves, and quality-checks your OpenAPI descriptions, all of which comes in handy for various phases of the API Lifecycle.
|
|
5
|
+
Create your own rulesets to make API governance easy, publish beautiful API reference documentation, and more.
|
|
6
|
+
Supports OpenAPI 3.1, 3.0 and OpenAPI 2.0 (legacy Swagger), AsyncAPI 3.0 and 2.6, Arazzo 1.0.
|
|
4
7
|
|
|
5
8
|

|
|
6
9
|

|
|
@@ -32,9 +35,8 @@ The minimum required versions of Node.js and NPM are 18.17.0 and 10.8.2 respecti
|
|
|
32
35
|
|
|
33
36
|
### Docker
|
|
34
37
|
|
|
35
|
-
To give the Docker container access to the OpenAPI description files, you need to
|
|
36
|
-
|
|
37
|
-
in the current working directory, you need the following command:
|
|
38
|
+
To give the Docker container access to the OpenAPI description files, you need to mount the containing directory as a volume.
|
|
39
|
+
Assuming the API description is rooted in the current working directory, you need the following command:
|
|
38
40
|
|
|
39
41
|
```sh
|
|
40
42
|
docker run --rm -v $PWD:/spec redocly/cli lint path-to-root-file.yaml
|
|
@@ -51,25 +53,36 @@ docker run --rm -v $PWD:/spec redocly/cli lint path-to-root-file.yaml
|
|
|
51
53
|
|
|
52
54
|
### Generate API reference documentation
|
|
53
55
|
|
|
54
|
-
Redocly CLI is a great way to render API reference documentation.
|
|
56
|
+
Redocly CLI is a great way to render API reference documentation.
|
|
57
|
+
It uses open source [Redoc](https://github.com/redocly/redoc) to build your documentation.
|
|
58
|
+
Use a command like this:
|
|
55
59
|
|
|
56
60
|
```sh
|
|
57
61
|
redocly build-docs openapi.yaml
|
|
58
62
|
```
|
|
59
63
|
|
|
60
|
-
Your API reference docs are in `redoc-static.html` by default.
|
|
64
|
+
Your API reference docs are in `redoc-static.html` by default.
|
|
65
|
+
You can customize this in many ways.
|
|
66
|
+
[Read the main docs](https://redocly.com/docs/cli/commands/build-docs) for more information.
|
|
61
67
|
|
|
62
|
-
> :bulb: Redocly also has [hosted API reference docs](https://redocly.com/docs/api-registry/guides/api-registry-quickstart/), a (commercial) alternative to Redoc.
|
|
68
|
+
> :bulb: Redocly also has [hosted API reference docs](https://redocly.com/docs/api-registry/guides/api-registry-quickstart/), a (commercial) alternative to Redoc.
|
|
69
|
+
> Both Redoc and Redocly API reference docs can be worked on locally using the `preview-docs` command.
|
|
63
70
|
|
|
64
71
|
### Bundle multiple OpenAPI documents
|
|
65
72
|
|
|
66
|
-
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.
|
|
73
|
+
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.
|
|
74
|
+
Redocly CLI to the rescue! It has a `bundle` command you can use to recombine all of those documents back into one single document.
|
|
75
|
+
The bundled output that Redocly CLI provides is clean, tidy, and looks like a human made it.
|
|
67
76
|
|
|
68
77
|
### Automate API guidelines with Linting
|
|
69
78
|
|
|
70
|
-
Check that your API matches the expected API guidelines by using the `lint` command.
|
|
79
|
+
Check that your API matches the expected API guidelines by using the `lint` command.
|
|
80
|
+
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.
|
|
81
|
+
Automating API guidelines means you can keep APIs consistent and secure throughout their lifecycle.
|
|
82
|
+
Even better, you can shape the design of the API before it even exists by combining API linting with a design-first API workflow.
|
|
71
83
|
|
|
72
|
-
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.
|
|
84
|
+
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.
|
|
85
|
+
It's also designed for humans, with meaningful error messages to help you get your API right every time.
|
|
73
86
|
|
|
74
87
|
Try it like this:
|
|
75
88
|
|
|
@@ -77,9 +90,12 @@ Try it like this:
|
|
|
77
90
|
redocly lint openapi.yaml
|
|
78
91
|
```
|
|
79
92
|
|
|
80
|
-
**Configure the rules** as you wish.
|
|
93
|
+
**Configure the rules** as you wish.
|
|
94
|
+
Other API Linters use complicated identifiers like JSONPath, but Redocly makes life easy with simple expressions that understand the OpenAPI structure.
|
|
95
|
+
You 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.
|
|
81
96
|
|
|
82
|
-
**Format the output** in whatever way you need.
|
|
97
|
+
**Format the output** in whatever way you need.
|
|
98
|
+
The `stylish` output is as good as it sounds, but if you need JSON or Checkstyle outputs to integrate with other tools, the `lint` command can output those too.
|
|
83
99
|
|
|
84
100
|
**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.
|
|
85
101
|
|
|
@@ -87,7 +103,8 @@ redocly lint openapi.yaml
|
|
|
87
103
|
|
|
88
104
|
### Transform an OpenAPI description
|
|
89
105
|
|
|
90
|
-
If your OpenAPI description isn't everything you hoped it would be, enhance it with the Redocly [decorators](https://redocly.com/docs/cli/decorators) feature.
|
|
106
|
+
If your OpenAPI description isn't everything you hoped it would be, enhance it with the Redocly [decorators](https://redocly.com/docs/cli/decorators) feature.
|
|
107
|
+
This allows you to:
|
|
91
108
|
|
|
92
109
|
- Publish reference docs with a subset of endpoints for public use
|
|
93
110
|
- Improve the docs by adding examples and descriptions
|
|
@@ -95,11 +112,13 @@ If your OpenAPI description isn't everything you hoped it would be, enhance it w
|
|
|
95
112
|
|
|
96
113
|
## Data collection
|
|
97
114
|
|
|
98
|
-
This tool [collects data](./docs/usage-data.md) to help Redocly improve our products and services.
|
|
115
|
+
This tool [collects data](./docs/usage-data.md) to help Redocly improve our products and services.
|
|
116
|
+
You can opt out by setting the `REDOCLY_TELEMETRY` environment variable to `off`.
|
|
99
117
|
|
|
100
118
|
## Update notifications
|
|
101
119
|
|
|
102
|
-
Redocly CLI checks for updates on startup.
|
|
120
|
+
Redocly CLI checks for updates on startup.
|
|
121
|
+
You can disable this by setting the `REDOCLY_SUPPRESS_UPDATE_NOTICE` environment variable to `true`.
|
|
103
122
|
|
|
104
123
|
## More resources
|
|
105
124
|
|
|
@@ -111,4 +130,5 @@ Thanks to [graphql-js](https://github.com/graphql/graphql-js) and [eslint](https
|
|
|
111
130
|
|
|
112
131
|
## Development
|
|
113
132
|
|
|
114
|
-
Contributions are welcome!
|
|
133
|
+
Contributions are welcome!
|
|
134
|
+
All the information you need is in [CONTRIBUTING.md](CONTRIBUTING.md).
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/cli",
|
|
3
|
-
"version": "0.0.0-snapshot.
|
|
3
|
+
"version": "0.0.0-snapshot.1739918020",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
7
|
-
"
|
|
8
|
-
"
|
|
7
|
+
"redocly": "bin/cli.js",
|
|
8
|
+
"openapi": "bin/cli.js"
|
|
9
9
|
},
|
|
10
10
|
"engines": {
|
|
11
11
|
"node": ">=18.17.0",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"Roman Hotsiy <roman@redocly.com> (https://redocly.com/)"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@redocly/openapi-core": "0.0.0-snapshot.
|
|
39
|
+
"@redocly/openapi-core": "0.0.0-snapshot.1739918020",
|
|
40
40
|
"abort-controller": "^3.0.0",
|
|
41
41
|
"chokidar": "^3.5.1",
|
|
42
42
|
"colorette": "^1.2.0",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"simple-websocket": "^9.0.0",
|
|
61
61
|
"styled-components": "^6.0.7",
|
|
62
62
|
"yargs": "17.0.1",
|
|
63
|
-
"@redocly/respect-core": "0.0.0-snapshot.
|
|
63
|
+
"@redocly/respect-core": "0.0.0-snapshot.1739918020"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"@types/configstore": "^5.0.1",
|