-
Notifications
You must be signed in to change notification settings - Fork 158
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
Showing
3 changed files
with
203 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@redocly/openapi-core": minor | ||
"@redocly/cli": minor | ||
--- | ||
|
||
Added JSON Schema format validation. |
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,188 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`E2E lint validate-schema-formats 1`] = ` | ||
validating /openapi.yaml... | ||
[1] openapi.yaml:65:14 at #/components/examples/Date/value | ||
Example value must conform to the schema: must match format "date-time". | ||
63 | examples: | ||
64 | Date: | ||
65 | value: '2000-01-01' | ||
| ^^^^^^^^^^^^ | ||
66 | DateTime: | ||
67 | value: '2000-01-01T12:00:00Z' | ||
referenced from openapi.yaml:13:15 at #/paths/~1test/get/responses/200/content/application~1json | ||
Error was generated by the no-invalid-media-type-examples rule. | ||
[2] openapi.yaml:29:11 at #/components/schemas/Date/examples/1 | ||
Example value must conform to the schema: type must be string. | ||
27 | examples: | ||
28 | - '2000-01-01' # correct | ||
29 | - 2000 # incorrect type | ||
| ^^^^ | ||
30 | - incorrect | ||
31 | Email: | ||
referenced from openapi.yaml:25:7 at #/components/schemas/Date | ||
Error was generated by the no-invalid-schema-examples rule. | ||
[3] openapi.yaml:30:11 at #/components/schemas/Date/examples/2 | ||
Example value must conform to the schema: must match format "date". | ||
28 | - '2000-01-01' # correct | ||
29 | - 2000 # incorrect type | ||
30 | - incorrect | ||
| ^^^^^^^^^ | ||
31 | Email: | ||
32 | description: Email address for ticket purchaser. | ||
referenced from openapi.yaml:25:7 at #/components/schemas/Date | ||
Error was generated by the no-invalid-schema-examples rule. | ||
[4] openapi.yaml:37:11 at #/components/schemas/Email/examples/1 | ||
Example value must conform to the schema: must match format "email". | ||
35 | examples: | ||
36 | - [email protected] # correct | ||
37 | - wrong.format | ||
| ^^^^^^^^^^^^ | ||
38 | Id: | ||
39 | type: string | ||
referenced from openapi.yaml:32:7 at #/components/schemas/Email | ||
Error was generated by the no-invalid-schema-examples rule. | ||
[5] openapi.yaml:43:11 at #/components/schemas/Id/examples/1 | ||
Example value must conform to the schema: must match format "uuid". | ||
41 | examples: | ||
42 | - 3be6453c-03eb-4357-ae5a-984a0e574a54 # correct | ||
43 | - incorrect | ||
| ^^^^^^^^^ | ||
44 | - 42 # wrong type | ||
45 | Time: | ||
referenced from openapi.yaml:39:7 at #/components/schemas/Id | ||
Error was generated by the no-invalid-schema-examples rule. | ||
[6] openapi.yaml:44:11 at #/components/schemas/Id/examples/2 | ||
Example value must conform to the schema: type must be string. | ||
42 | - 3be6453c-03eb-4357-ae5a-984a0e574a54 # correct | ||
43 | - incorrect | ||
44 | - 42 # wrong type | ||
| ^^ | ||
45 | Time: | ||
46 | type: string | ||
referenced from openapi.yaml:39:7 at #/components/schemas/Id | ||
Error was generated by the no-invalid-schema-examples rule. | ||
[7] openapi.yaml:51:11 at #/components/schemas/Time/examples/1 | ||
Example value must conform to the schema: must match pattern "^([01]\\d|2[0-3]):?([0-5]\\d)$". | ||
49 | examples: | ||
50 | - 09:00 # correct | ||
51 | - incorrect | ||
| ^^^^^^^^^ | ||
52 | - 09.00 # wrong type | ||
53 | Oneof: | ||
referenced from openapi.yaml:46:7 at #/components/schemas/Time | ||
Error was generated by the no-invalid-schema-examples rule. | ||
[8] openapi.yaml:52:11 at #/components/schemas/Time/examples/2 | ||
Example value must conform to the schema: type must be string. | ||
50 | - 09:00 # correct | ||
51 | - incorrect | ||
52 | - 09.00 # wrong type | ||
| ^^^^^ | ||
53 | Oneof: | ||
54 | type: string | ||
referenced from openapi.yaml:46:7 at #/components/schemas/Time | ||
Error was generated by the no-invalid-schema-examples rule. | ||
[9] openapi.yaml:61:11 at #/components/schemas/Oneof/examples/2 | ||
Example value must conform to the schema: must match format "date". | ||
59 | - '2000-01-01' # correct | ||
60 | - monthly # correct | ||
61 | - wrong | ||
| ^^^^^ | ||
62 | | ||
63 | examples: | ||
referenced from openapi.yaml:54:7 at #/components/schemas/Oneof | ||
Error was generated by the no-invalid-schema-examples rule. | ||
[10] openapi.yaml:61:11 at #/components/schemas/Oneof/examples/2 | ||
Example value must conform to the schema: must match pattern "^(month|year)ly$". | ||
59 | - '2000-01-01' # correct | ||
60 | - monthly # correct | ||
61 | - wrong | ||
| ^^^^^ | ||
62 | | ||
63 | examples: | ||
referenced from openapi.yaml:54:7 at #/components/schemas/Oneof | ||
Error was generated by the no-invalid-schema-examples rule. | ||
[11] openapi.yaml:61:11 at #/components/schemas/Oneof/examples/2 | ||
Example value must conform to the schema: must match exactly one schema in oneOf. | ||
59 | - '2000-01-01' # correct | ||
60 | - monthly # correct | ||
61 | - wrong | ||
| ^^^^^ | ||
62 | | ||
63 | examples: | ||
referenced from openapi.yaml:54:7 at #/components/schemas/Oneof | ||
Error was generated by the no-invalid-schema-examples rule. | ||
/openapi.yaml: validated in <test>ms | ||
❌ Validation failed with 11 errors. | ||
run \`redocly lint --generate-ignore-file\` to add all problems to the ignore file. | ||
`; |