this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

encoding/jsonschema: add test case for issue 3176

The current logic gets the disjunction wrong when
generating CUE for jsonschema when there's a
oneOf that is then modified by an additional constraint.
Specifically the resulting schema does not allow
a string value when it should.

This CL adds a test case that will be fixed in a subsequent CL.

For #3176.

Signed-off-by: Roger Peppe <rogpeppe@gmail.com>
Change-Id: I96a24d981fb4a90c55c9f09bee6db1bbde047648
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1199400
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>

+26
+26
encoding/jsonschema/testdata/issue3176.txtar
··· 1 + -- definition.json -- 2 + { 3 + "oneOf": [ 4 + { 5 + "type": "object" 6 + }, 7 + { 8 + "maxLength": 3, 9 + "type": "string" 10 + } 11 + ], 12 + "patternProperties": { 13 + "^x-": { 14 + "type": "string" 15 + } 16 + } 17 + } 18 + -- out/decode/cue -- 19 + import "strings" 20 + 21 + ({ 22 + ... 23 + } | strings.MaxRunes(3)) & { 24 + {[=~"^x-" & !~"^()$"]: string} 25 + ... 26 + }