-
Notifications
You must be signed in to change notification settings - Fork 195
docs: add arazzo rules documentation #1697
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
Closed
Closed
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
cdb9222
chore: add arazzo rules documentation
DmitryAnansky c4de777
chore: add arazzo rules documentation
DmitryAnansky ba802b9
chore: document requestBody-replacements-unique rule
DmitryAnansky 09d0016
chore: document arazzo rules
DmitryAnansky c59483d
chore: document async rules
DmitryAnansky fb35ae1
chore: update links
DmitryAnansky 866978a
Apply suggestions from code review
lornajane 7b024e6
docs: copyedit, remove diagrams and page slugs, update for accuracy
lornajane f83e4c0
docs: add new rules to built-in rules page, add format grouping
lornajane 85f99fd
docs: expand on the rules configuration options for basic/configured/…
lornajane f8a7bc2
docs: add descriptions and sorting to the new format rules
lornajane 988785a
docs: Split rules config to separate page, add missing rules to list,…
lornajane 5cf1a58
docs: add copy/paste versions of ruleset configurations for each api …
lornajane 5ca82e9
docs: fix a renamed rule and a stray ARAZZO label
lornajane 8478eac
docs: run prettier
lornajane 9d18cb7
docs: adjust rule example to be more obvious
lornajane ce5d903
docs: update link
lornajane 3074a89
docs: update AsyncAPI channel rules with more info, add all rules to …
lornajane baaf09b
Apply suggestions from code review
lornajane 00c91c0
docs: remove mentions of the per-format rule configuration feature un…
lornajane b3f89f3
chore: add sourceDescriptions-not-empty rule docs
DmitryAnansky 47a7701
docs: Adjust design principles sections of Arazzo rules
lornajane 91b04e4
docs: Make vale happy
lornajane File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,72 @@ | ||
| # 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 should 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 an **incorrect** `parameters` list: | ||
|
|
||
| ```yaml Incorrect example | ||
| workflows: | ||
| - workflowId: get-museum-hours | ||
| parameters: | ||
| - in: header | ||
| name: Authorization | ||
| value: Main Og== | ||
| - in: header | ||
| name: Authorization | ||
| value: Basic Og== | ||
| ``` | ||
|
|
||
| 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 hidden or 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,75 @@ | ||||||||||||||||||
| # 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 an **incorrect** `replacements` list: | ||||||||||||||||||
|
|
||||||||||||||||||
| ```yaml Incorrect 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: name | ||||||||||||||||||
| value: 'another name' | ||||||||||||||||||
|
Comment on lines
+48
to
+51
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This example is invalid not because of duplicate targets, but because targets must be JSON Pointer or XPath. This is not.
Suggested change
|
||||||||||||||||||
| ``` | ||||||||||||||||||
|
|
||||||||||||||||||
| 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' | ||||||||||||||||||
|
Comment on lines
+67
to
+70
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||
| ``` | ||||||||||||||||||
|
|
||||||||||||||||||
| ## Resources | ||||||||||||||||||
|
|
||||||||||||||||||
| - [Rule source](https://github.com/Redocly/redocly-cli/blob/main/packages/core/src/rules/arazzo/requestBody-replacements-unique.ts) | ||||||||||||||||||
This file contains hidden or 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,66 @@ | ||
| # 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 should 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 an **incorrect** `sourceDescriptions` list: | ||
|
|
||
| ```yaml Incorrect example | ||
| sourceDescriptions: | ||
| - name: museum-api | ||
| type: openapi | ||
| url: ../openapi.yaml | ||
| - name: museum-api | ||
| type: openapi | ||
| url: ../petstore.yaml | ||
| ``` | ||
|
|
||
| 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 hidden or 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,94 @@ | ||
| # 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 an **incorrect** usage: | ||
|
|
||
| ```yaml Incorrect example | ||
| arazzo: '1.0.0' | ||
| info: | ||
| title: Cool API | ||
| version: 1.0.0 | ||
| description: A cool API | ||
| sourceDescriptions: [] | ||
| 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 | ||
| ``` | ||
|
|
||
| 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) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.