Skip to content

Commit

Permalink
chore: add sourceDescriptions-not-empty rule docs
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitryAnansky committed Oct 18, 2024
1 parent 00c91c0 commit b3f89f3
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 0 deletions.
93 changes: 93 additions & 0 deletions docs/rules/arazzo/sourceDescriptions-not-empty.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# sourceDescriptions-not-empty

The Source Description must have at least one entry.

| Arazzo | Compatibility |
| ------ | ------------- |
| 1.0.0 ||

## API design principles

According to the Arazzo spec `sourceDescriptions` is required and the list must have at least one entry.

## 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)
1 change: 1 addition & 0 deletions docs/rules/built-in-rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ Within the Arazzo family of rules, there are rules for the main Arazzo specifica
- [step-onSuccess-unique](./arazzo/step-onSuccess-unique.md): the `onSuccess` actions of the `step` object must be unique
- [workflow-dependsOn](./arazzo/workflow-dependsOn.md): the items in the `workflow` `dependsOn` property must exist and be unique
- [workflowId-unique](./arazzo/workflowId-unique.md): the `workflowId` property must be unique across all workflows
- [sourceDescriptions-not-empty](./arazzo/sourceDescriptions-not-empty.md): the `sourceDescriptions` must be defined and the list must have at least one entry.

### Spot

Expand Down

0 comments on commit b3f89f3

Please sign in to comment.