-
Notifications
You must be signed in to change notification settings - Fork 0
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
e1cc87c
commit 6c98bad
Showing
8 changed files
with
111 additions
and
22 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
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,35 @@ | ||
# API rules | ||
|
||
1. [base-path-must-start-with-slash](#base-path-must-start-with-slash) | ||
|
||
## base-path-must-start-with-slash | ||
|
||
```yaml | ||
#spectral-test | ||
#spectral-should-not-fail-anywhere-✅: base-path-must-start-with-slash | ||
openapi: 3.0.1 | ||
info: | ||
title: Test | ||
version: 1.0.0 | ||
servers: | ||
- url: do-not-start-with-slash #in fact, it should fail here | ||
``` | ||
<details> | ||
<summary>Spectral rule 🤖</summary> | ||
```yaml | ||
#spectral-rule | ||
base-path-must-start-with-slash: | ||
description: Base path must start with /. | ||
message: "{{description}}. But was {{value}}." | ||
given: $.servers[*] | ||
severity: error | ||
then: | ||
field: url | ||
function: pattern | ||
functionOptions: | ||
match: "^\/" | ||
``` | ||
</details> |
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,8 @@ | ||
formats: ["oas3"] | ||
extends: "spectral:oas" | ||
aliases: | ||
parameters: | ||
- $.paths[*].parameters | ||
- $.paths[*][*].parameters | ||
#rules will be injected from the rules/*.md files | ||
rules: |
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,19 @@ | ||
formats: ["oas3"] | ||
extends: "spectral:oas" | ||
aliases: | ||
parameters: | ||
- $.paths[*].parameters | ||
- $.paths[*][*].parameters | ||
#rules will be injected from the rules/*.md files | ||
rules: | ||
base-path-must-start-with-slash: | ||
description: Base path must start with /. | ||
message: "{{description}}. But was {{value}}." | ||
given: $.servers[*] | ||
severity: error | ||
then: | ||
field: url | ||
function: pattern | ||
functionOptions: | ||
match: "^\/" | ||
|