Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Run prettier on all docs files #1334

Merged
merged 1 commit into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"printWidth": 100,
"singleQuote": true
"singleQuote": true,
"embeddedLanguageFormatting": "off"
}
17 changes: 8 additions & 9 deletions docs/api-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ This option is ideal for teams that want **hassle-free hosting**, lots of **them

Get started with Redocly API reference:

* [Sign up for Workflows](https://app.redocly.com/signup) and add your OpenAPI description to the registry to get started immediately.
* Check out the [documentation for using the API registry](https://redocly.com/docs/api-registry/guides/api-registry-quickstart/) to learn more.
* Use Redocly CLI for [local preview of API documentation](./commands/preview-docs.md) while you're making changes to the API description or docs configuration.
* Add the [Redocly VS Code extension](https://redocly.com/docs/redocly-openapi/) to your IDE for better OpenAPI editing support and autocomplete on Redocly configuration settings.
- [Sign up for Workflows](https://app.redocly.com/signup) and add your OpenAPI description to the registry to get started immediately.
- Check out the [documentation for using the API registry](https://redocly.com/docs/api-registry/guides/api-registry-quickstart/) to learn more.
- Use Redocly CLI for [local preview of API documentation](./commands/preview-docs.md) while you're making changes to the API description or docs configuration.
- Add the [Redocly VS Code extension](https://redocly.com/docs/redocly-openapi/) to your IDE for better OpenAPI editing support and autocomplete on Redocly configuration settings.

## Redoc

Expand All @@ -32,8 +32,7 @@ Use this option if you plan to host your API reference documentation yourself, o

Get started with Redoc:

* Visit the [Redoc section of the docs](https://redocly.com/docs/redoc/quickstart/) to learn more about redoc
* Check out the project and community [on GitHub](https://github.com/redocly/redoc).
* Use Redocly CLI for [local preview of API documentation](./commands/preview-docs.md) while you're making changes to the API description or docs configuration, and to [build your API docs](./commands/build-docs.md).
* Add the [Redocly VS Code extension](https://redocly.com/docs/redocly-openapi/) to your IDE for better OpenAPI editing support and autocomplete on Redocly configuration settings.

- Visit the [Redoc section of the docs](https://redocly.com/docs/redoc/quickstart/) to learn more about redoc
- Check out the project and community [on GitHub](https://github.com/redocly/redoc).
- Use Redocly CLI for [local preview of API documentation](./commands/preview-docs.md) while you're making changes to the API description or docs configuration, and to [build your API docs](./commands/build-docs.md).
- Add the [Redocly VS Code extension](https://redocly.com/docs/redocly-openapi/) to your IDE for better OpenAPI editing support and autocomplete on Redocly configuration settings.
6 changes: 3 additions & 3 deletions docs/api-standards.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ Choose between one of the existing rulesets, or compile your own. There are some

Once the ruleset is created, use it with your API and Redocly in any or all of these ways:

* every update to an API in the API registry is linted with the rules for that API
* use Redocly CLI to lint APIs as part of your continuous integration setup, such as in GitHub Actions
* during development, check the API you are working on using Redocly CLI on your local machine
- every update to an API in the API registry is linted with the rules for that API
- use Redocly CLI to lint APIs as part of your continuous integration setup, such as in GitHub Actions
- during development, check the API you are working on using Redocly CLI on your local machine

By establishing good standards and making them part of your development workflow, keeping the APIs as you would like them becomes painless good practice, even when there are many changes being worked on.

Expand Down
10 changes: 4 additions & 6 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ toc:
maxDepth: 2
---


# Redocly CLI changelog

<!-- do-not-remove -->
Expand Down Expand Up @@ -164,7 +163,7 @@ No code changes.
### Features

- Resolve `$ref`s in preprocessors.
- Create the `spec-strict-refs` rule to ensure `$ref` usage is in accordance with the OpenAPI specification.
- Create the `spec-strict-refs` rule to ensure `$ref` usage is in accordance with the OpenAPI specification.

### Fixes

Expand Down Expand Up @@ -210,7 +209,6 @@ No code changes.
- Stopped executing decorators and preprocessors upon the `join` command.
- Sort top-level OAS3 keys in `bundle` and `join` commands.


## 1.0.0-beta.125 (2023-04-06)

### Features
Expand Down Expand Up @@ -260,12 +258,14 @@ No code changes.
- Moved and renamed the `features.openapi` and `features.mockServer` into the `theme` object with the names `openapi` and `mockServer`.

Before:

```yaml
features.openapi: {}
features.mockServer: {}
```

After:

```yaml
theme:
openapi: {}
Expand Down Expand Up @@ -383,14 +383,14 @@ theme:
- Fixed incorrect behavior for the `no-invalid-media-type-examples` rule in combination with the `allOf` keyword.

## 1.0.0-beta.109 (2022-09-08)

### Features

- Added rfc7807 problem details rule.
- Improved error messages by adding `referenced from` information.
- Added the [`spec-components-invalid-map-name`](./rules/spec-components-invalid-map-name.md) rule for component map names validation.
- Added a new lint `--format` option: `summary`.


### Fixes

- Fixed an issue with multi-line strings in literal mode.
Expand Down Expand Up @@ -423,7 +423,6 @@ theme:
- Fixed docs for `no-server-example.com`.
- Incorrect schema description dereferenced.


## 1.0.0-beta.107 (2022-08-16)

### Changes
Expand All @@ -434,7 +433,6 @@ theme:

- Introduced severity level `off` for assertions.


## 1.0.0-beta.106 (2022-08-09)

### Fixes
Expand Down
2 changes: 1 addition & 1 deletion docs/commands/build-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ redocly build-docs <api> -t custom.hbs --templateOptions.metaDescription "Page m
| --template, -t | string | Uses custom [Handlebars](https://handlebarsjs.com/) templates to render your OpenAPI description. |
| --templateOptions | string | Adds template options you want to pass to your custom Handlebars template. To add options, use dot notation. |
| --theme.openapi | string | Customizes your output with [Redoc functionality options](https://redocly.com/docs/api-reference-docs/configuration/functionality/) or [Redoc theming options](https://redocly.com/docs/api-reference-docs/configuration/theming/). |
| --title | string | Sets the page title. |
| --title | string | Sets the page title. |
| --version | boolean | Shows version number. |

## Examples
Expand Down
62 changes: 51 additions & 11 deletions docs/commands/lint.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@ redocly lint --version

## Options

| Option | Type | Description |
| ---------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| Option | Type | Description |
| ---------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| apis | [string] | Array of API description filenames that need to be linted. See [the Apis section](#apis) for more options. |
| --config | string | Specify path to the [configuration file](#custom-configuration-file). |
| --extends | [string] | [Extend a specific configuration](#extend-configuration) (defaults or config file settings). |
| --config | string | Specify path to the [configuration file](#custom-configuration-file). |
| --extends | [string] | [Extend a specific configuration](#extend-configuration) (defaults or config file settings). |
| --format | string | Format for the output.<br />**Possible values:** `codeframe`, `stylish`, `json`, `checkstyle`, `codeclimate`, `summary`. Default value is `codeframe`. |
| --generate-ignore-file | boolean | [Generate ignore file](#generate-ignore-file). |
| --help | boolean | Show help. |
| --lint-config | string | Specify the severity level for the configuration file. <br/> **Possible values:** `warn`, `error`, `off`. Default value is `warn`. |
| --max-problems | integer | Truncate output to display the specified [maximum number of problems](#max-problems). Default value is 100. |
| --skip-preprocessor | [string] | Ignore certain preprocessors. See the [Skip preprocessor or rule section](#skip-preprocessor-or-rule) below. |
| --skip-rule | [string] | Ignore certain rules. See the [Skip preprocessor or rule section](#skip-preprocessor-or-rule) below. |
| --version | boolean | Show version number. |
| --generate-ignore-file | boolean | [Generate ignore file](#generate-ignore-file). |
| --help | boolean | Show help. |
| --lint-config | string | Specify the severity level for the configuration file. <br/> **Possible values:** `warn`, `error`, `off`. Default value is `warn`. |
| --max-problems | integer | Truncate output to display the specified [maximum number of problems](#max-problems). Default value is 100. |
| --skip-preprocessor | [string] | Ignore certain preprocessors. See the [Skip preprocessor or rule section](#skip-preprocessor-or-rule) below. |
| --skip-rule | [string] | Ignore certain rules. See the [Skip preprocessor or rule section](#skip-preprocessor-or-rule) below. |
| --version | boolean | Show version number. |

## Examples

Expand All @@ -57,16 +57,20 @@ The `apis` argument can also use any glob format supported by your file system.
Instead of full paths, you can use names listed in the `apis` section of your Redocly configuration file.
{% tabs %}
{% tab label="Command" %}

```bash
redocly lint core@v1
```

{% /tab %}
{% tab label="Configuration file" %}

```yaml
apis:
core@v1:
root: ./openapi/api-description.json
```

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

Expand All @@ -77,11 +81,14 @@ In this case, after resolving the path behind the `core@v1` name (see the `Confi
You can omit apis completely when executing the `lint` command to check all APIs defined in the configuration file.
{% tabs %}
{% tab label="Command" %}

```bash
redocly lint
```

{% /tab %}
{% tab label="Configuration file" %}

```yaml
apis:
core@v1:
Expand All @@ -91,6 +98,7 @@ apis:
sandbox:
root: ./openapi/sandbox.yaml
```

{% /tab %}
{% /tabs %}
In this case, if no API descriptions are specified, `lint` validates all apis listed under `apis` in your Redocly configuration file. The presence of the configuration file is mandatory.
Expand Down Expand Up @@ -125,14 +133,18 @@ Some formats, such as CheckStyle or JSON, don't work well when mulitple APIs are
{% /admonition %}

#### Codeframe (default)

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

```bash
redocly lint --format=codeframe
## equivalent to: redocly lint
```

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

```bash
[1] resources/petstore-with-errors.yaml:16:3 at #/paths/~1pets?id

Expand All @@ -147,26 +159,32 @@ Don't put query string items in the path, they belong in parameters with `in: qu

Error was generated by the path-not-include-query rule.
```

{% /tab %}
{% /tabs %}
Note that the problems are displayed in the following format: `file:line:column`. For example, `petstore-with-errors.yaml:16:3`.

Depending on the terminal emulator you use, it may be possible to directly click this indicator to edit the file in place.

#### Stylish

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

```bash
redocly lint --format=stylish
```

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

```bash
openapi/core.yaml:
15:7 error spec Property `operationIds` is not expected here.
22:11 error spec Property `require` is not expected here.
14:7 warning operation-operationId Operation object should contain `operationId` field.
```

{% /tab %}
{% /tabs %}
In this format, `lint` shows the file name, line number, and column where the problem occurred. However, the output is compressed and omits other contexts and suggestions.
Expand All @@ -176,11 +194,14 @@ In this format, `lint` shows the file name, line number, and column where the pr
It can be useful to get the output in JSON format to be processed by other tools.
{% tabs %}
{% tab label="Command" %}

```bash
redocly lint --format=json
```

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

```bash
{
"totals": {
Expand Down Expand Up @@ -223,18 +244,23 @@ redocly lint --format=json
]
}
```

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

#### Checkstyle

The `lint` command also supports the [Checkstyle](https://checkstyle.org/) XML report format.
{% tabs %}
{% tab label="Command" %}

```bash
redocly lint --format=checkstyle
```

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

```bash
<?xml version="1.0" encoding="UTF-8"?>
<checkstyle version="4.3">
Expand All @@ -245,6 +271,7 @@ redocly lint --format=checkstyle
</file>
</checkstyle>
```

{% /tab %}
{% /tabs %}
Due to the limitations of this format, only file name, line, column, severity,
Expand All @@ -256,33 +283,42 @@ omitted.
With the `--max-problems` option, you can limit the number of problems displayed in the command output. If the number of detected problems exceeds the specified threshold, the remaining problems are hidden under the "spoiler message" that lets you know how many problems were hidden.
{% tabs %}
{% tab label="Command" %}

```bash
redocly lint --max-problems 200
```

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

```bash
...
< ... 2 more problems hidden > increase with `--max-problems N`
```

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

### Generate ignore file

With this option, you can generate the `.redocly.lint-ignore.yaml` file to suppress error and warning severity problems in the output. You still receive visual feedback to let you know how many problems were ignored.

This option is useful when you have an API design standard, but have some exceptions to the rule (for example, a legacy API operation). It allows for highly granular control.
{% tabs %}
{% tab label="Command" %}

```shell
redocly lint openapi/petstore.yaml --generate-ignore-file
```

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

```bash
...
Generated ignore file with 3 problems.
```

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

Expand Down Expand Up @@ -316,14 +352,18 @@ The rule in the example is named `spec`, which indicates compliance with the Ope
You may want to skip specific preprocessors or rules upon running the command.
{% tabs %}
{% tab label="Skip preprocessors" %}

```bash
redocly lint --skip-preprocessor=discriminator-mapping-to-one-of --skip-preprocessor=another-example
```

{% /tab %}
{% tab label="Skip rules" %}

```bash
redocly lint --skip-rule=no-sibling-refs --skip-rule=no-parent-tags
```

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

Expand Down
4 changes: 1 addition & 3 deletions docs/custom-plugins/custom-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

You can bundle configurations under the `configs` key in your plugin code. These configuration bundles are
useful when you declare multiple rules or decorators in your plugin, and you want to
define within the plugin how to combine them. Each plugin can have multiple
define within the plugin how to combine them. Each plugin can have multiple
configuration bundles, and the user can use any of them in their `redocly.yaml`
configuration file.


The following is an example plugin, defining two configuration bundles:

```js
Expand Down Expand Up @@ -46,4 +45,3 @@ If your configuration includes only Redocly built-in rules and decorators, try
using a [ruleset](../rules.md#rulesets) to achieve this (it's simpler than a
plugin).
{% /admonition %}

Loading
Loading