-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: report on child keys when using pattern or notPattern assertions
- Loading branch information
Showing
4 changed files
with
66 additions
and
7 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
21 changes: 21 additions & 0 deletions
21
__tests__/lint/assertions-pattern-report-location/openapi.yaml
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,21 @@ | ||
openapi: 3.1.0 | ||
paths: | ||
/one: | ||
description: A correct path item name | ||
post: | ||
requestBody: | ||
content: | ||
application/json: | ||
schema: | ||
type: string | ||
enum: | ||
- Correct | ||
- Wrong | ||
/two/test: | ||
description: A wrong path item name | ||
/two/ref: | ||
$ref: '#/components/paths/' | ||
components: | ||
pathItems: | ||
ReferencedPathItem: | ||
description: Referenced from a wrong path item name |
26 changes: 26 additions & 0 deletions
26
__tests__/lint/assertions-pattern-report-location/redocly.yaml
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,26 @@ | ||
apis: | ||
main: | ||
root: ./openapi.yaml | ||
|
||
rules: | ||
rule/restful-paths: | ||
subject: | ||
type: Paths | ||
assertions: | ||
notPattern: '/[^{/}]+/[^{/}]+/' | ||
message: Two consecutive path segments don't have a variable | ||
|
||
rule/path-starts-from-correct: | ||
subject: | ||
type: Paths | ||
assertions: | ||
pattern: /^\/two/ | ||
message: Path item should start with the `two` prefix | ||
|
||
rule/enums: | ||
subject: | ||
type: Schema | ||
property: enum | ||
assertions: | ||
pattern: /Correct/ | ||
message: Enums should contain the `Correct` word |
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