forked from ansible/schemas
-
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.
meta: refactor schema versioning to improve errors
This greatly improves the quality of the validating error messages. Improvement of error messages comes with a minor downside, as from now on schema validation for meta would not pass on empty files. Users will have to either put real content in meta files to pass schema validation, such as version at least to pass. That was needed for technical reasons as without it the error messages would be considerably less easy to understand. Related: python-jsonschema/jsonschema#1002
- Loading branch information
Showing
15 changed files
with
135 additions
and
253 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
Empty 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# ajv errors | ||
|
||
```json | ||
[ | ||
{ | ||
"instancePath": "", | ||
"keyword": "type", | ||
"message": "must be object", | ||
"params": { | ||
"type": "object" | ||
}, | ||
"schemaPath": "#/type" | ||
}, | ||
{ | ||
"instancePath": "", | ||
"keyword": "if", | ||
"message": "must match \"then\" schema", | ||
"params": { | ||
"failingKeyword": "then" | ||
}, | ||
"schemaPath": "#/if" | ||
}, | ||
{ | ||
"instancePath": "", | ||
"keyword": "type", | ||
"message": "must be object", | ||
"params": { | ||
"type": "object" | ||
}, | ||
"schemaPath": "#/type" | ||
} | ||
] | ||
``` | ||
|
||
# check-jsonschema | ||
|
||
stdout: | ||
|
||
```json | ||
{ | ||
"status": "fail", | ||
"errors": [ | ||
{ | ||
"filename": "negative_test/roles/empty_meta/meta/main.yml", | ||
"path": "$", | ||
"message": "None is not of type 'object'", | ||
"has_sub_errors": false | ||
}, | ||
{ | ||
"filename": "negative_test/roles/empty_meta/meta/main.yml", | ||
"path": "$", | ||
"message": "None is not of type 'object'", | ||
"has_sub_errors": false | ||
} | ||
], | ||
"parse_errors": [] | ||
} | ||
``` |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
version: 1 | ||
galaxy_info: | ||
description: bar | ||
min_ansible_version: "2.9" | ||
|
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
--- | ||
version: 1 # <-- old standalone role | ||
galaxy_info: | ||
description: foo | ||
min_ansible_version: "2.9" | ||
|
Oops, something went wrong.