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 cases for nested values

The current `state.value` logic looks wrong: it sets the `allowedTypes`
value recursively when it encounters a structured value such
as an array or an object even though only the top level
of the value should influence the allowed types.

As it happens, the fact that `usedTypes` is set at the same
time hides this error, and it _seems_ that no other
test fails as a result. However, upcoming changes will reveal
this shortcoming, so we add a couple of test cases to
show the fix.

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

+20
+10
encoding/jsonschema/testdata/constarray.txtar
··· 1 + -- type.json -- 2 + { 3 + "type": "array", 4 + "const": [ 5 + 1 6 + ] 7 + } 8 + 9 + -- out/decode/cue -- 10 + [1]
+10
encoding/jsonschema/testdata/constobj.txtar
··· 1 + 2 + -- type.json -- 3 + { 4 + "type": "object", 5 + "const": {"a": 1} 6 + } 7 + 8 + -- out/decode/cue -- 9 + a: 1 10 + ...