-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
901a6d6
commit f6dacce
Showing
23 changed files
with
1,355 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# parameters-unique | ||
|
||
Requires unique values in the `parameters` lists. | ||
|
||
| Arazzo | Compatibility | | ||
| ------ | ------------- | | ||
| 1.0.0 | ✅ | | ||
|
||
## Design principles | ||
|
||
A list of `parameters` that are applicable to a step or all the steps described in a workflow must not contain duplicates. | ||
If duplicates are present, unexpected parameter overrides could cause problems. | ||
|
||
This ruled checks parameter lists in the following locations: | ||
|
||
- `workflows.[workflow].parameters` | ||
- `workflows.[workflow[.steps.[step].parameters` | ||
- `x-parameters` | ||
|
||
## Configuration | ||
|
||
| Option | Type | Description | | ||
| -------- | ------ | ------------------------------------------------------- | | ||
| severity | string | Possible values: `off`, `warn`, `error`. Default `off`. | | ||
|
||
An example configuration: | ||
|
||
```yaml | ||
rules: | ||
parameters-unique: error | ||
``` | ||
## Examples | ||
Given the following configuration: | ||
```yaml | ||
rules: | ||
parameters-unique: error | ||
``` | ||
Example of a **correct** `parameters` list: | ||
|
||
```yaml Correct example | ||
workflows: | ||
- workflowId: get-museum-hours | ||
parameters: | ||
- in: header | ||
name: Authorization | ||
value: Basic Og== | ||
- in: header | ||
name: X-Forwarded-For | ||
value: 1.2.3.4 | ||
``` | ||
|
||
## Resources | ||
|
||
- [Rule source](https://github.com/Redocly/redocly-cli/blob/main/packages/core/src/rules/arazzo/parameters-unique.ts) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# requestBody-replacements-unique | ||
|
||
Requires the `replacements` in the `step.requestBody` object to be unique. | ||
|
||
| Arazzo | Compatibility | | ||
| ------ | ------------- | | ||
| 1.0.0 | ✅ | | ||
|
||
## Design principles | ||
|
||
The list of locations and values to set within a payload must not have duplicates that might result in content override. | ||
|
||
## Configuration | ||
|
||
| Option | Type | Description | | ||
| -------- | ------ | ------------------------------------------------------- | | ||
| severity | string | Possible values: `off`, `warn`, `error`. Default `off`. | | ||
|
||
An example configuration: | ||
|
||
```yaml | ||
rules: | ||
requestBody-replacements-unique: error | ||
``` | ||
## Examples | ||
Given the following configuration: | ||
```yaml | ||
rules: | ||
requestBody-replacements-unique: error | ||
``` | ||
Example of a **correct** `replacements` list: | ||
|
||
```yaml Correct example | ||
workflows: | ||
- workflowId: events-crud | ||
steps: | ||
- stepId: create-event | ||
operationPath: $sourceDescriptions.museum-api#/paths/~1special-events/post | ||
requestBody: | ||
payload: | ||
name: 'Mermaid Treasure Identification and Analysis' | ||
description: 'Identify and analyze mermaid treasures' | ||
replacements: | ||
- target: name | ||
value: 'new name' | ||
- target: description | ||
value: 'another description' | ||
``` | ||
|
||
## Resources | ||
|
||
- [Rule source](https://github.com/Redocly/redocly-cli/blob/main/packages/core/src/rules/arazzo/requestBody-replacements-unique.ts) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# sourceDescriptions-name-unique | ||
|
||
The `name` property of the Source Description object must be unique across all source descriptions. | ||
|
||
| Arazzo | Compatibility | | ||
| ------ | ------------- | | ||
| 1.0.0 | ✅ | | ||
|
||
## Design principles | ||
|
||
To avoid confusion or unexpected outputs, each Source Description object must have a unique `name` property. | ||
Especially in a longer list of sources, this could be difficult to identify and could have unwanted side effects. | ||
|
||
## Configuration | ||
|
||
| Option | Type | Description | | ||
| -------- | ------ | ------------------------------------------------------- | | ||
| severity | string | Possible values: `off`, `warn`, `error`. Default `off`. | | ||
|
||
An example configuration: | ||
|
||
```yaml | ||
rules: | ||
sourceDescriptions-name-unique: error | ||
``` | ||
## Examples | ||
Given the following configuration: | ||
```yaml | ||
rules: | ||
sourceDescriptions-name-unique: error | ||
``` | ||
Example of a **correct** `sourceDescriptions` list: | ||
|
||
```yaml Correct example | ||
sourceDescriptions: | ||
- name: museum-api | ||
type: openapi | ||
url: ../openapi.yaml | ||
- name: pets-api | ||
type: openapi | ||
url: ../petstore.yaml | ||
``` | ||
|
||
## Related rules | ||
|
||
- [sourceDescription-type](./sourceDescriptions-type.md) | ||
|
||
## Resources | ||
|
||
- [Rule source](https://github.com/Redocly/redocly-cli/blob/main/packages/core/src/rules/arazzo/sourceDescriptions-name-unique.ts) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# sourceDescriptions-not-empty | ||
|
||
The Source Description must have at least one entry. | ||
|
||
| Arazzo | Compatibility | | ||
| ------ | ------------- | | ||
| 1.0.0 | ✅ | | ||
|
||
## Design principles | ||
|
||
Source descriptions are an important part of an Arazzo description, and at least one entry must exist. | ||
If the list is empty, this could indicate an omission or another problem; this rule alerts you if that happens. | ||
|
||
## Configuration | ||
|
||
| Option | Type | Description | | ||
| -------- | ------ | ------------------------------------------------------- | | ||
| severity | string | Possible values: `off`, `warn`, `error`. Default `off`. | | ||
|
||
An example configuration: | ||
|
||
```yaml | ||
rules: | ||
sourceDescriptions-not-empty: error | ||
``` | ||
## Examples | ||
Given the following configuration: | ||
```yaml | ||
rules: | ||
sourceDescriptions-not-empty: error | ||
``` | ||
Example of a **correct** usage: | ||
```yaml Correct example | ||
arazzo: '1.0.0' | ||
info: | ||
title: Cool API | ||
version: 1.0.0 | ||
description: A cool API | ||
sourceDescriptions: | ||
- name: museum-api | ||
type: openapi | ||
url: openapi.yaml | ||
- name: another-api | ||
type: openapi | ||
url: openapi.yaml | ||
workflows: | ||
- workflowId: get-museum-hours | ||
description: This workflow demonstrates how to get the museum opening hours and buy tickets. | ||
parameters: | ||
- in: header | ||
name: Authorization | ||
value: Basic Og== | ||
steps: | ||
- stepId: get-museum-hours | ||
description: >- | ||
Get museum hours by resolving request details with getMuseumHours operationId from openapi.yaml description. | ||
operationId: $sourceDescriptions.museum-api.getMuseumHours | ||
successCriteria: | ||
- condition: $statusCode == 200 | ||
``` | ||
## Resources | ||
- [Rule source](https://github.com/Redocly/redocly-cli/blob/main/packages/core/src/rules/arazzo/sourceDescriptions-not-empty.ts) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# sourceDescriptions-type | ||
|
||
The `type` property of the Source Description object must be either `openapi` or `arazzo`. | ||
|
||
| Arazzo | Compatibility | | ||
| ------ | ------------- | | ||
| 1.0.0 | ✅ | | ||
|
||
## Design principles | ||
|
||
Arazzo currently supports either an OpenAPI file or another Arazzo file as the source description. | ||
This rule makes sure that the type is clearly identified and is one of the supported types. | ||
|
||
## Configuration | ||
|
||
| Option | Type | Description | | ||
| -------- | ------ | ------------------------------------------------------- | | ||
| severity | string | Possible values: `off`, `warn`, `error`. Default `off`. | | ||
|
||
An example configuration: | ||
|
||
```yaml | ||
rules: | ||
sourceDescriptions-type: error | ||
``` | ||
## Examples | ||
Given the following configuration: | ||
```yaml | ||
rules: | ||
sourceDescriptions-type: error | ||
``` | ||
Example of a **correct** `sourceDescriptions` list: | ||
|
||
```yaml Correct example | ||
sourceDescriptions: | ||
- name: museum-api | ||
type: openapi | ||
url: ../openapi.yaml | ||
- name: tickets-from-museum-api | ||
type: arazzo | ||
url: museum-tickets.arazzo.yaml | ||
``` | ||
|
||
## Related rules | ||
|
||
- [sourceDescription-name-unique](./sourceDescriptions-name-unique.md) | ||
|
||
## Resources | ||
|
||
- [Rule source](https://github.com/Redocly/redocly-cli/blob/main/packages/core/src/rules/arazzo/sourceDescription-type.ts) |
Oops, something went wrong.
f6dacce
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coverage report
Test suite run success
834 tests passing in 121 suites.
Report generated by 🧪jest coverage report action from f6dacce