-
Notifications
You must be signed in to change notification settings - Fork 294
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
encoding/jsonschema: decode
contains
as list.MatchN
The `contains` keyword accepts any valid JSON Schema which is decoded as a non-concrete constraint. However the `list.Contains` validator checks for equality and expects its second argument to be concrete. This change uses `list.MatchN` to support the `contains` keyword. Fixes #3367 Change-Id: I454a1f6166db3195e4003eb2512e6d550e041cdf Signed-off-by: haoqixu <[email protected]> Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1199603 Reviewed-by: Roger Peppe <[email protected]> Unity-Result: CUE porcuepine <[email protected]> TryBot-Result: CUEcueckoo <[email protected]>
- Loading branch information
Showing
3 changed files
with
26 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
-- schema.yaml -- | ||
type: object | ||
properties: | ||
p1: | ||
type: array | ||
contains: {} | ||
|
||
additionalProperties: false | ||
|
||
-- out/decode/extract -- | ||
import "list" | ||
|
||
p1?: list.MatchN(>=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