Skip to content

Commit bf93125

Browse files
committed
instructions for configuring redocly rules
1 parent 0dc3b55 commit bf93125

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

README.md

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -942,16 +942,31 @@ This will set the `Cache-Control` Response Header to have a value of "no-store"
942942

943943
Validation for the OpenAPI Description is now (as of 0.0.90) done by [Redocly](https://redocly.com/). This is a slightly less opinionated validator for an OpenAPI Description, it should result in less errors around "YAML Anchors". It's also a maintained library, and has support for OpenAPI 3.1.0 which I hope to be able to support very soon.
944944

945+
I am making use of https://www.npmjs.com/package/@redocly/openapi-core, which I have been warned is likely to change. If you notice anything going wrong with validation of your OpenAPI Description, feel free to open an issue here. I make active use of this library, so will hopefully come across those issues too.
946+
947+
### Rules
948+
945949
I have configured the validator to use these Rules:
946950

947-
* [spec](https://redocly.com/docs/cli/rules/spec/)
948-
* [path-parameters-defined](https://redocly.com/docs/cli/rules/path-parameters-defined/)
949-
* [operation-2xx-response](https://redocly.com/docs/cli/rules/operation-2xx-response/)
950-
* [operation-4xx-response](https://redocly.com/docs/cli/rules/operation-4xx-response/)
951-
* [operation-operationId-unique](https://redocly.com/docs/cli/rules/operation-operationid-unique/)
952-
* [path-declaration-must-exist](https://redocly.com/docs/cli/rules/path-declaration-must-exist/)
951+
- [spec](https://redocly.com/docs/cli/rules/spec/)
952+
- [path-parameters-defined](https://redocly.com/docs/cli/rules/path-parameters-defined/)
953+
- [operation-2xx-response](https://redocly.com/docs/cli/rules/operation-2xx-response/)
954+
- [operation-4xx-response](https://redocly.com/docs/cli/rules/operation-4xx-response/)
955+
- [operation-operationId-unique](https://redocly.com/docs/cli/rules/operation-operationid-unique/)
956+
- [path-declaration-must-exist](https://redocly.com/docs/cli/rules/path-declaration-must-exist/)
953957

954-
I am making use of https://www.npmjs.com/package/@redocly/openapi-core, which I have been warned is likely to change. If you notice anything going wrong with validation of your OpenAPI Description, feel free to open an issue here. I make active use of this library, so will hopefully come across those issues too.
958+
However, you can configure your own rules from the [ruleset available on the Redocly site](https://redocly.com/docs/cli/rules/built-in-rules/). To do this, you will need to create a `redocly.json` file within an `options` folder. The file should look like:
959+
960+
```json
961+
{
962+
"spec": "error",
963+
"path-parameters-defined": "error",
964+
"operation-2xx-response": "error",
965+
"operation-4xx-response": "error",
966+
"operation-operationId-unique": "error",
967+
"path-declaration-must-exist": "error"
968+
}
969+
```
955970

956971
## Example configuration
957972

0 commit comments

Comments
 (0)