-
Notifications
You must be signed in to change notification settings - Fork 42
Support --continue/-c in the metaschema command
#855
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 @@ | ||
| MAKE DIRECTORY schemas | ||
|
|
||
| WRITE schemas/schema_1.json UNTIL EOF | ||
| { | ||
| "$schema": "http://json-schema.org/draft-04/schema#", | ||
| "minimum": "foo" | ||
| } | ||
| EOF | ||
|
|
||
| WRITE schemas/schema_2.json UNTIL EOF | ||
| { | ||
| "$schema": "http://json-schema.org/draft-04/schema#", | ||
| "minimum": 1 | ||
| } | ||
| EOF | ||
|
|
||
| // Validation failure | ||
| RUN metaschema schemas --continue --verbose STDIN /dev/null IN . INTO result_0.txt EXPECTING 2 | ||
|
|
||
| WRITE expected_0.txt UNTIL EOF | ||
| 2> fail: schemas/schema_1.json | ||
| 2> error: Schema validation failure | ||
| 2> The value was expected to be of type number but it was of type string | ||
| 2> at instance location "/minimum" (line 3, column 3) | ||
| 2> at evaluate path "/properties/minimum/type" | ||
| 2> The object value was expected to validate against the 33 defined properties subschemas | ||
| 2> at instance location "" (line 1, column 1) | ||
| 2> at evaluate path "/properties" | ||
| 2> ok: schemas/schema_2.json | ||
| 2> matches http://json-schema.org/draft-04/schema# | ||
| 2> | ||
| 2> 2 validated, 1 passed, 1 failed | ||
| EOF | ||
|
|
||
| COMPARE result_0.txt AGAINST expected_0.txt | ||
This file contains hidden or 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,47 @@ | ||
| MAKE DIRECTORY schemas | ||
|
|
||
| WRITE schemas/schema_1.json UNTIL EOF | ||
| { | ||
| "$schema": "http://json-schema.org/draft-04/schema#", | ||
| "minimum": "foo" | ||
| } | ||
| EOF | ||
|
|
||
| WRITE schemas/schema_2.json UNTIL EOF | ||
| { | ||
| "$schema": "http://json-schema.org/draft-04/schema#", | ||
| "minimum": 1 | ||
| } | ||
| EOF | ||
|
|
||
| // Validation failure | ||
| RUN metaschema schemas --json --continue STDIN /dev/null IN . INTO result_0.txt EXPECTING 2 | ||
|
|
||
| WRITE expected_0.txt UNTIL EOF | ||
| 1> { | ||
| 1> "valid": false, | ||
| 1> "errors": [ | ||
| 1> { | ||
| 1> "keywordLocation": "/properties/minimum/type", | ||
| 1> "absoluteKeywordLocation": "http://json-schema.org/draft-04/schema#/properties/minimum/type", | ||
| 1> "instanceLocation": "/minimum", | ||
| 1> "instancePosition": [ 3, 3, 3, 18 ], | ||
| 1> "error": "The value was expected to be of type number but it was of type string" | ||
| 1> }, | ||
| 1> { | ||
| 1> "keywordLocation": "/properties", | ||
| 1> "absoluteKeywordLocation": "http://json-schema.org/draft-04/schema#/properties", | ||
| 1> "instanceLocation": "", | ||
| 1> "instancePosition": [ 1, 1, 4, 1 ], | ||
| 1> "error": "The object value was expected to validate against the 33 defined properties subschemas" | ||
| 1> } | ||
| 1> ] | ||
| 1> } | ||
| 1> { | ||
| 1> "valid": true | ||
| 1> } | ||
| 2> schemas/schema_1.json | ||
| 2> schemas/schema_2.json | ||
| EOF | ||
|
|
||
| COMPARE result_0.txt AGAINST expected_0.txt |
This file contains hidden or 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 @@ | ||
| MAKE DIRECTORY schemas | ||
|
|
||
| WRITE schemas/schema_1.json UNTIL EOF | ||
| { | ||
| "$schema": "http://json-schema.org/draft-04/schema#", | ||
| "minimum": "foo" | ||
| } | ||
| EOF | ||
|
|
||
| WRITE schemas/schema_2.json UNTIL EOF | ||
| { | ||
| "$schema": "http://json-schema.org/draft-04/schema#", | ||
| "minimum": 1 | ||
| } | ||
| EOF | ||
|
|
||
| // Validation failure | ||
| RUN metaschema schemas --verbose STDIN /dev/null IN . INTO result_0.txt EXPECTING 2 | ||
|
|
||
| WRITE expected_0.txt UNTIL EOF | ||
| 2> fail: schemas/schema_1.json | ||
| 2> error: Schema validation failure | ||
| 2> The value was expected to be of type number but it was of type string | ||
| 2> at instance location "/minimum" (line 3, column 3) | ||
| 2> at evaluate path "/properties/minimum/type" | ||
| 2> The object value was expected to validate against the 33 defined properties subschemas | ||
| 2> at instance location "" (line 1, column 1) | ||
| 2> at evaluate path "/properties" | ||
| 2> | ||
| 2> 1 validated, 0 passed, 1 failed | ||
| 2> warning: Stopped at first failure, pass --continue/-c to keep going | ||
| EOF | ||
|
|
||
| COMPARE result_0.txt AGAINST expected_0.txt |
This file contains hidden or 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,44 @@ | ||
| MAKE DIRECTORY schemas | ||
|
|
||
| WRITE schemas/schema_1.json UNTIL EOF | ||
| { | ||
| "$schema": "http://json-schema.org/draft-04/schema#", | ||
| "minimum": "foo" | ||
| } | ||
| EOF | ||
|
|
||
| WRITE schemas/schema_2.json UNTIL EOF | ||
| { | ||
| "$schema": "http://json-schema.org/draft-04/schema#", | ||
| "minimum": 1 | ||
| } | ||
| EOF | ||
|
|
||
| // Validation failure | ||
| RUN metaschema schemas --json STDIN /dev/null IN . INTO result_0.txt EXPECTING 2 | ||
|
|
||
| WRITE expected_0.txt UNTIL EOF | ||
| 1> { | ||
| 1> "valid": false, | ||
| 1> "errors": [ | ||
| 1> { | ||
| 1> "keywordLocation": "/properties/minimum/type", | ||
| 1> "absoluteKeywordLocation": "http://json-schema.org/draft-04/schema#/properties/minimum/type", | ||
| 1> "instanceLocation": "/minimum", | ||
| 1> "instancePosition": [ 3, 3, 3, 18 ], | ||
| 1> "error": "The value was expected to be of type number but it was of type string" | ||
| 1> }, | ||
| 1> { | ||
| 1> "keywordLocation": "/properties", | ||
| 1> "absoluteKeywordLocation": "http://json-schema.org/draft-04/schema#/properties", | ||
| 1> "instanceLocation": "", | ||
| 1> "instancePosition": [ 1, 1, 4, 1 ], | ||
| 1> "error": "The object value was expected to validate against the 33 defined properties subschemas" | ||
| 1> } | ||
| 1> ] | ||
| 1> } | ||
| 2> schemas/schema_1.json | ||
| 2> warning: Stopped at first failure, pass --continue/-c to keep going | ||
| EOF | ||
|
|
||
| COMPARE result_0.txt AGAINST expected_0.txt |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
P3: These failure tests only assert the human-readable text output. Add a
--jsonvariant for both the stop and--continuepaths so the structured JSON output (onevalidresult per validated schema, including the warning on stderr) is also asserted, matching the existingfail_directory_json.clitestpattern.Prompt for AI agents