-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for conditional prompting in bundle init (#971)
## Changes This PR introduces the `skip_prompt_if` extension to the jsonschema library. If the inputs provided by the user match the JSON schema then the prompt for that property is skipped. Right now only constant checks are supported, but if in the future more complicated conditionals are required, this can be extended to support `allOf`, `oneOf`, `anyOf` etc allowing template authors to specify conditionals of arbitary complexity. ## Tests Unit tests and manually.
- Loading branch information
1 parent
1f1ed6d
commit bdef0f7
Showing
7 changed files
with
318 additions
and
3 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
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
9 changes: 9 additions & 0 deletions
9
libs/jsonschema/testdata/schema-load-int/schema-invalid-const.json
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,9 @@ | ||
{ | ||
"type": "object", | ||
"properties": { | ||
"def": { | ||
"type": "integer", | ||
"const": 5.1 | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -5,6 +5,10 @@ | |
"type": "integer", | ||
"default": 1, | ||
"enum": [1,2,3] | ||
}, | ||
"def": { | ||
"type": "integer", | ||
"const": 5 | ||
} | ||
} | ||
} |
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
Oops, something went wrong.