Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 16 additions & 26 deletions markdown/docs/guides/validate.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,35 +57,25 @@ To get started:
1. Install [Spectral](https://meta.stoplight.io/docs/spectral/b8391e051b7d8-installation).
2. Create a file named `.spectral.yaml` to begin writing your API description and document rules.
Example:
```js
{
"rules": {
// add your own rules here
}
}
```yaml
rules:
# add your own rules here
```

3. Create and add your own custom ruleset:
```js
{
"rules": {
"valid-document-version": {
"message": "Application title must start with upper case",
"severity": "error",
"given": "$.info",
"then": [
{
"field": "title",
"function": "pattern",
"functionOptions": {
"match": "^[A-Z]"
}
}
]
}
}
}
```

```yaml
rules:
valid-document-version:
message: Application title must start with upper case
severity: error
given: "$.info"
then:
- field: title
function: pattern
functionOptions:
match: "^[A-Z]"
```

4. After setting up Spectral and creating custom rules following steps 1 - 3, validate your AsyncAPI document using this Spectral CLI command:

Expand Down