this repo has no description
0
fork

Configure Feed

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

encoding/jsonschema: fix type exclusion test

This test was added by https://cue-review.googlesource.com/c/cue/+/5648
but included a case that was later made an error in
https://cue-review.googlesource.com/c/cue/+/6302 (the self-contradictory
`allOf` case), thus meaning the rest of the test was not
actually checked.

We move that case into its own test, ensuring that the other
cases pass.

We also rename the `emptyanyof` because it is not actually
testing an empty anyOf, but rather an empty object _inside_
an anyOf.

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

+12 -12
encoding/jsonschema/testdata/emptyanyof.txtar encoding/jsonschema/testdata/emptyobjinanyof.txtar
+10
encoding/jsonschema/testdata/impossibleallof.txtar
··· 1 + -- type.json -- 2 + { 3 + "allOf": [ 4 + { "type": "object" }, 5 + { "type": "string" } 6 + ] 7 + } 8 + -- out/decode/err -- 9 + constraint not allowed because type string is excluded: 10 + type.json:4:11
+2 -12
encoding/jsonschema/testdata/typedis.txtar
··· 33 33 "minimum": 3 34 34 } 35 35 ] 36 - }, 37 - "empty": { 38 - "allOf": [ 39 - { "type": "object" }, 40 - { "type": "string" } 41 - ] 42 36 } 43 37 } 44 38 } 45 - -- out/decode/err -- 46 - constraint not allowed because type string is excluded: 47 - type.json:39:15 48 39 -- out/decode/cue -- 49 40 // Main schema 50 41 intOrString1?: int | string 51 42 intOrString2?: int | string 52 - intOrString3?: string | int 53 - disjunction?: string | int | int & >=3 54 - empty?: _|_ 43 + intOrString3?: (int | string) & (number | string) 44 + disjunction?: (int | string) & (number | string) | int & >=3 55 45 ...