You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+29-11Lines changed: 29 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,7 @@
1
1
# Redocly CLI Contributing Guide
2
2
3
-
Hi! We're really excited that you are interested in contributing to Redocly CLI. Before submitting your contribution though, please make sure to take a moment and read through the following guidelines.
3
+
Hi! We're really excited that you are interested in contributing to Redocly CLI.
4
+
Before submitting your contribution though, please make sure to take a moment and read through the following guidelines.
To compile the code, run `npm run compile`. To do that on the fly, run `npm run watch` in a separate thread.
50
51
51
-
To run a specific CLI command, use `npm run cli`, e.g. `npm run cli -- lint resources/museum.yaml --format=stylish`. Please notice that the extra `--` is required to pass arguments to the CLI rather than to NPM itself.
52
+
To run a specific CLI command, use `npm run cli`, e.g. `npm run cli -- lint resources/museum.yaml --format=stylish`.
53
+
Please notice that the extra `--` is required to pass arguments to the CLI rather than to NPM itself.
52
54
53
55
Format your code with `npm run prettier` before committing.
54
56
@@ -70,13 +72,15 @@ To test local changes as a package, you can use the following steps:
70
72
71
73
1. Optionally, bump the version of the packages ([see details](#version-updating)).
72
74
73
-
1. Run `npm run pack:prepare` in the repository's root. This generates **redocly-cli.tgz**, **respect-core.tgz**, and **openapi-core.tgz** files.
75
+
1. Run `npm run pack:prepare` in the repository's root.
76
+
This generates **redocly-cli.tgz**, **respect-core.tgz**, and **openapi-core.tgz** files.
74
77
75
78
1. Copy those **.tgz** files to a destination folder and then run `npm install redocly-cli.tgz` there to install Redocly CLI. To install `openapi-core` do the same but with **openapi-core.tgz** file.
76
79
77
80
## Contribute documentation
78
81
79
-
Additions and updates to our documentation are very welcome. You can find the documentation in the `docs/` folder, and this is published to https://redocly.com/docs/cli/ as part of our main website.
82
+
Additions and updates to our documentation are very welcome.
83
+
You can find the documentation in the `docs/` folder, and this is published to https://redocly.com/docs/cli/ as part of our main website.
80
84
81
85
To preview your documentation changes locally:
82
86
@@ -90,11 +94,14 @@ redocly preview
90
94
91
95
By default, you can access the docs preview at http://localhost:4000 or http://127.0.0.1:4000.
92
96
93
-
> Please note that currently the custom markdoc tags used in the main website are not available in the local preview version, and links that point to the wider website do show as errors when using a local platform. The pull request workflows generate a full preview, so rest assured that you are able to check everything is in good shape before we review and merge your changes.
97
+
> Please note that currently the custom markdoc tags used in the main website are not available in the local preview version, and links that point to the wider website do show as errors when using a local platform.
98
+
> The pull request workflows generate a full preview, so rest assured that you are able to check everything is in good shape before we review and merge your changes.
94
99
95
100
### Prose linting
96
101
97
-
We are proud of our docs. When you open a pull request, we lint the prose using [Vale](https://vale.sh/). You can also install this tool locally and run it from the root of the project with:
102
+
We are proud of our docs.
103
+
When you open a pull request, we lint the prose using [Vale](https://vale.sh/).
104
+
You can also install this tool locally and run it from the root of the project with:
98
105
99
106
```bash
100
107
vale docs/
@@ -110,7 +117,9 @@ We use [Markdownlint](https://github.com/DavidAnson/markdownlint) to check that
110
117
111
118
### Markdown link checking
112
119
113
-
We use [`mlc`](https://github.com/becheran/mlc) to check the links in the `docs/` folder. This tool runs automatically on every pull request, but you can also run it locally if you want to. Visit the project homepage to find the installation instructions for your platform, and then run the command like this:
120
+
We use [`mlc`](https://github.com/becheran/mlc) to check the links in the `docs/` folder.
121
+
This tool runs automatically on every pull request, but you can also run it locally if you want to.
122
+
Visit the project homepage to find the installation instructions for your platform, and then run the command like this:
114
123
115
124
```bash
116
125
mlc docs/
@@ -120,7 +129,8 @@ It only checks links within the local docs (it can't check links to other docs s
120
129
121
130
## Built-in rules changes
122
131
123
-
After adding a new rule, make sure it is added to the `minimal`, `recommended`, `recommended-strict` (the same as the previous but with warnings turned into error) and `all` rulesets with appropriate severity levels. The defaults are `off` for `minimal` and `recommended` and `error` for `all`.
132
+
After adding a new rule, make sure it is added to the `minimal`, `recommended`, `recommended-strict` (the same as the previous but with warnings turned into error) and `all` rulesets with appropriate severity levels.
133
+
The defaults are `off` for `minimal` and `recommended` and `error` for `all`.
124
134
Also add the rule to the built-in rules list in [the config types tree](./packages/core/src/types/redocly-yaml.ts).
125
135
126
136
Separately, open a merge request with the corresponding documentation changes.
@@ -137,11 +147,16 @@ Environment variables should not affect the **core** package logic.
137
147
138
148
### Command line arguments
139
149
140
-
Use them to provide some arguments that are specific to a certain command. Think of them as modifiers. They should not affect the **core** package logic.
150
+
Use them to provide some arguments that are specific to a certain command.
151
+
Think of them as modifiers.
152
+
They should not affect the **core** package logic.
141
153
142
154
### Configuration file
143
155
144
-
The **redocly.yaml** file is the most flexible way of providing arguments. Please use it to provide arguments that are common for all the commands, for a specific command, or for a specific API. It could be used for providing arguments for both **cli** and **core** packages. Please refer to the [configuration file](https://redocly.com/docs/cli/configuration/) documentation for more details.
156
+
The **redocly.yaml** file is the most flexible way of providing arguments.
157
+
Please use it to provide arguments that are common for all the commands, for a specific command, or for a specific API.
158
+
It could be used for providing arguments for both **cli** and **core** packages.
159
+
Please refer to the [configuration file](https://redocly.com/docs/cli/configuration/) documentation for more details.
145
160
146
161
## Exit codes
147
162
@@ -215,14 +230,17 @@ If you made any changes, make sure to compile the code before running the tests.
215
230
-**`packages/core/src/types`**: contains the common types for several OpenAPI versions.
216
231
-**`packages/core/src/typings`**: contains the common Typescript typings.
217
232
233
+
-**`packages/respect-core`**: contains the Respect core package.
234
+
218
235
-**`resources`**: contains some example API descriptions and configuration files that might be useful for testing.
219
236
220
237
## Release flow
221
238
222
239
We use [Changesets](https://github.com/changesets/changesets) flow.
223
240
After merging a PR with a changeset, the release PR is automatically created.
224
241
225
-
If the pipelines are not starting, close and reopen the PR. Merging that PR triggers the release process.
242
+
If the pipelines are not starting, close and reopen the PR.
Copy file name to clipboardExpand all lines: README.md
+36-16Lines changed: 36 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,9 @@
1
1
# Redocly CLI
2
2
3
-
[@Redocly](https://redocly.com) 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, and publish beautiful API reference documentation. Supports OpenAPI 3.1, 3.0 and OpenAPI 2.0 (legacy Swagger).
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

Redocly CLI is a great way to render API reference documentation. It uses open source [Redoc](https://github.com/redocly/redoc) to build your documentation. Use a command like this:
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. You can customize this in many ways. [Read the main docs](https://redocly.com/docs/cli/commands/build-docs) for more information.
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. Both Redoc and Redocly API reference docs can be worked on locally using the `preview-docs` command.
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. Redocly CLI to the rescue! It has a `bundle` 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.
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. 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.
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. It's also designed for humans, with meaningful error messages to help you get your API right every time.
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
76
89
```sh
77
90
redocly lint openapi.yaml
78
91
```
79
92
80
-
**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 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.
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. 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.
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
86
102
[Learn more about API standards and configuring Redocly rules](https://redocly.com/docs/cli/api-standards).
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. This allows you to:
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
94
111
- Adapt an existing OpenAPI description, and replace details like URLs for use on staging platforms
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. You can opt out by setting the `REDOCLY_TELEMETRY` environment variable to `off`.
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. You can disable this by setting the `REDOCLY_SUPPRESS_UPDATE_NOTICE` environment variable to `true`.
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! All the information you need is in [CONTRIBUTING.md](CONTRIBUTING.md).
133
+
Contributions are welcome!
134
+
All the information you need is in [CONTRIBUTING.md](CONTRIBUTING.md).
0 commit comments