-
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: add JSON Schema 2019-09+ validation keyword - dependentRequired (#…
- Loading branch information
1 parent
aefb024
commit f807944
Showing
9 changed files
with
209 additions
and
2 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": patch | ||
"@redocly/cli": patch | ||
--- | ||
|
||
Added JSON Schema draft 2019-09+ validation keyword - `dependentRequired`. |
2 changes: 1 addition & 1 deletion
2
__tests__/check-config/wrong-config-type-extensions-in-assertions/snapshot.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
__tests__/lint-config/invalid-config-assertation-config-type/snapshot.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
34 changes: 34 additions & 0 deletions
34
__tests__/lint/spec-json-schema-validation-dependentRequired/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,34 @@ | ||
openapi: 3.1.0 | ||
info: | ||
title: test json schema validation keyword - dependentRequired | ||
version: 1.0.0 | ||
paths: | ||
'/thing': | ||
get: | ||
summary: a sample api | ||
responses: | ||
'200': | ||
description: OK | ||
content: | ||
'application/json': | ||
schema: | ||
$ref: '#/components/schemas/test_schema' | ||
examples: | ||
dependentRequired_passing: | ||
summary: an example schema | ||
value: { 'name': 'bobby', 'age': 25 } | ||
dependentRequired_failing: | ||
summary: an example schema | ||
value: { 'name': 'jennie' } | ||
components: | ||
schemas: | ||
test_schema: | ||
type: object | ||
properties: | ||
name: | ||
type: string | ||
age: | ||
type: number | ||
dependentRequired: | ||
name: | ||
- age |
7 changes: 7 additions & 0 deletions
7
__tests__/lint/spec-json-schema-validation-dependentRequired/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,7 @@ | ||
apis: | ||
main: | ||
root: ./openapi.yaml | ||
|
||
rules: | ||
spec: error | ||
no-invalid-media-type-examples: error |
28 changes: 28 additions & 0 deletions
28
__tests__/lint/spec-json-schema-validation-dependentRequired/snapshot.js
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,28 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`E2E lint spec-json-schema-validation-dependentRequired 1`] = ` | ||
validating /openapi.yaml... | ||
[1] openapi.yaml:22:26 at #/paths/~1thing/get/responses/200/content/application~1json/examples/dependentRequired_failing/value | ||
Example value must conform to the schema: must have property age when property name is present. | ||
20 | dependentRequired_failing: | ||
21 | summary: an example schema | ||
22 | value: { 'name': 'jennie' } | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
23 | components: | ||
24 | schemas: | ||
referenced from openapi.yaml:14:15 at #/paths/~1thing/get/responses/200/content/application~1json | ||
Error was generated by the no-invalid-media-type-examples rule. | ||
/openapi.yaml: validated in <test>ms | ||
❌ Validation failed with 1 error. | ||
run \`redocly lint --generate-ignore-file\` to add all problems to the ignore file. | ||
`; |
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
f807944
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coverage report
Test suite run success
750 tests passing in 105 suites.
Report generated by 🧪jest coverage report action from f807944