Skip to content

Commit

Permalink
chore: document arazzo rules
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitryAnansky committed Aug 30, 2024
1 parent 2607b4f commit 00baee1
Show file tree
Hide file tree
Showing 12 changed files with 604 additions and 3 deletions.
77 changes: 77 additions & 0 deletions docs/rules/arazzo/sourceDescriptions-name-unique.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
---
slug: /docs/cli/rules/arazzo/sourceDescription-name-unique
---

# sourceDescription-name-unique

Requires the `name` property of the `sourceDescription` object must be unique across all source descriptions.

| ARAZZO | Compatibility |
| ------ | ------------- |
| 1.0.0 ||

```mermaid
flowchart TD
Root ==> sourceDescriptions --> sourceDescription --> name
style Contact fill:#codaf9,stroke:#0044d4,stroke-width:5px
```

## API design principles

To avoid confusion, each `sourceDescription` object should have a unique `name` property.

## Configuration

| Option | Type | Description |
| -------- | ------ | ------------------------------------------------------- |
| severity | string | Possible values: `off`, `warn`, `error`. Default `off`. |

An example configuration:

```yaml
arazzoRules:
sourceDescription-name-unique: error
```
## Examples
Given the following configuration:
```yaml
arazzoRules:
sourceDescription-name-unique: error
```
Example of an **incorrect** sourceDescription:
```yaml Object example
sourceDescriptions:
- name: museum-api
type: openapi
url: ../openapi.yaml
- name: museum-api
type: openapi
url: ../petstore.yaml
```
Example of a **correct** license:
```yaml Object example
sourceDescriptions:
- name: museum-api
type: openapi
url: ../openapi.yaml
- name: pets-api
type: openapi
url: ../petstore.yaml
```
## Related rules
- [sourceDescription-type](./sourceDescriptions-type)
## Resources
- [Rule source](https://github.com/Redocly/redocly-cli/blob/main/packages/core/src/rules/arazzo/sourceDescriptions-name-unique.ts)
77 changes: 77 additions & 0 deletions docs/rules/arazzo/sourceDescriptions-type.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
---
slug: /docs/cli/rules/arazzo/sourceDescription-type
---

# sourceDescription-type

Requires the `type` property of the `sourceDescription` object must be either `openapi` or `arazzo`.

| ARAZZO | Compatibility |
| ------ | ------------- |
| 1.0.0 ||

```mermaid
flowchart TD
Root ==> sourceDescriptions --> sourceDescription --> type
style Contact fill:#codaf9,stroke:#0044d4,stroke-width:5px
```

## API design principles

By the Arazzo standard the possible values are "openapi" or "arazzo".

## Configuration

| Option | Type | Description |
| -------- | ------ | ------------------------------------------------------- |
| severity | string | Possible values: `off`, `warn`, `error`. Default `off`. |

An example configuration:

```yaml
arazzoRules:
sourceDescription-type: error
```
## Examples
Given the following configuration:
```yaml
arazzoRules:
sourceDescription-type: error
```
Example of an **incorrect** sourceDescription:
```yaml Object example
sourceDescriptions:
- name: museum-api
type: openapi
url: ../openapi.yaml
- name: tickets-from-museum-api
type: none
x-serverUrl: 'http://localhost/api'
```
Example of a **correct** license:
```yaml Object 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)
98 changes: 98 additions & 0 deletions docs/rules/arazzo/step-onFailure-unique.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
---
slug: /docs/cli/rules/arazzo/step-onFailure-unique
---

# step-onFailure-unique

Requires the `onFailure` actions of the `step` object to be unique.

| ARAZZO | Compatibility |
| ------ | ------------- |
| 1.0.0 ||

```mermaid
flowchart TD
Root ==> workflows --> workflow --> steps --> step --> onFailure
style Contact fill:#codaf9,stroke:#0044d4,stroke-width:5px
```

## API design principles

An array of failure action objects that specify what to do upon step failure.
Each `onFailure` action should be unique to avoid confusion.

## Configuration

| Option | Type | Description |
| -------- | ------ | ------------------------------------------------------- |
| severity | string | Possible values: `off`, `warn`, `error`. Default `off`. |

An example configuration:

```yaml
arazzoRules:
step-onFailure-unique: error
```
## Examples
Given the following configuration:
```yaml
arazzoRules:
step-onFailure-unique: error
```
Example of an **incorrect** step:
```yaml Object example
workflows:
- workflowId: get-museum-hours
description: This workflow demonstrates how to get the museum opening hours and buy tickets.
steps:
- stepId: get-museum-hours
operationId: museum-api.getMuseumHours
successCriteria:
- condition: $statusCode == 200
onFailure:
- name: test
workflowId: events-crud
type: goto
- name: test
workflowId: events-crud
type: goto
- reference: $components.failureActions.notify
- reference: $components.failureActions.notify
```
Example of a **correct** step:
```yaml Object example
workflows:
- workflowId: get-museum-hours
description: This workflow demonstrates how to get the museum opening hours and buy tickets.
steps:
- stepId: get-museum-hours
operationId: museum-api.getMuseumHours
successCriteria:
- condition: $statusCode == 200
onFailure:
- name: call-crud-events
workflowId: events-crud
type: goto
- name: second-call-crud-events
workflowId: events-crud
type: goto
- reference: $components.failureActions.notify
- reference: $components.failureActions.report
```
## Related rules
- [step-onSuccess-unique](./step-onSuccess-unique.md)
## Resources
- [Rule source](https://github.com/Redocly/redocly-cli/blob/main/packages/core/src/rules/arazzo/step-onFailure-unique.ts)
98 changes: 98 additions & 0 deletions docs/rules/arazzo/step-onSuccess-unique.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
---
slug: /docs/cli/rules/arazzo/step-onSuccess-unique
---

# step-onSuccess-unique

Requires the `onSuccess` actions of the `step` object to be unique.

| ARAZZO | Compatibility |
| ------ | ------------- |
| 1.0.0 ||

```mermaid
flowchart TD
Root ==> workflows --> workflow --> steps --> step --> onSuccess
style Contact fill:#codaf9,stroke:#0044d4,stroke-width:5px
```

## API design principles

An array of success action objects that specify what to do upon step success.
Each `onSuccess` action should be unique to avoid confusion.

## Configuration

| Option | Type | Description |
| -------- | ------ | ------------------------------------------------------- |
| severity | string | Possible values: `off`, `warn`, `error`. Default `off`. |

An example configuration:

```yaml
arazzoRules:
step-onSuccess-unique: error
```
## Examples
Given the following configuration:
```yaml
arazzoRules:
step-onSuccess-unique: error
```
Example of an **incorrect** step:
```yaml Object example
workflows:
- workflowId: get-museum-hours
description: This workflow demonstrates how to get the museum opening hours and buy tickets.
steps:
- stepId: get-museum-hours
operationId: museum-api.getMuseumHours
successCriteria:
- condition: $statusCode == 200
onSuccess:
- name: test
workflowId: events-crud
type: goto
- name: test
workflowId: events-crud
type: goto
- reference: $components.successActions.notify
- reference: $components.successActions.notify
```
Example of a **correct** step:
```yaml Object example
workflows:
- workflowId: get-museum-hours
description: This workflow demonstrates how to get the museum opening hours and buy tickets.
steps:
- stepId: get-museum-hours
operationId: museum-api.getMuseumHours
successCriteria:
- condition: $statusCode == 200
onSuccess:
- name: call-crud-events
workflowId: events-crud
type: goto
- name: second-call-crud-events
workflowId: events-crud
type: goto
- reference: $components.successActions.notify
- reference: $components.successActions.report
```
## Related rules
- [step-onFailure-unique](./step-onFailure-unique.md)
## Resources
- [Rule source](https://github.com/Redocly/redocly-cli/blob/main/packages/core/src/rules/arazzo/step-onSuccess-unique.ts)
Loading

0 comments on commit 00baee1

Please sign in to comment.