this repo has no description
0
fork

Configure Feed

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

encoding/jsonschema: treat close as no-op for now

Currently we don't implement support for closed structs at all in
Generate, but in the meantime, treating `close(x)` as `x` is clearly
better than treating is as `_`.

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

+22 -50
+2 -2
encoding/jsonschema/external_teststats.txt
··· 9 9 10 10 v3-roundtrip: 11 11 schema extract (pass / total): 231 / 1363 = 16.9% 12 - tests (pass / total): 794 / 4803 = 16.5% 13 - tests on extracted schemas (pass / total): 794 / 895 = 88.7% 12 + tests (pass / total): 806 / 4803 = 16.8% 13 + tests on extracted schemas (pass / total): 806 / 895 = 90.1% 14 14 15 15 Optional tests: 16 16
+8
encoding/jsonschema/generate.go
··· 405 405 // See https://github.com/cue-lang/cue/issues/4133 for why 406 406 // we include "error()" as well as "error" 407 407 return &itemFalse{} 408 + case "close": 409 + // TODO incorporate closedness into the model 410 + // For now, just treat close(x) the same as x. 411 + if len(args) != 2 { 412 + g.addError(v, fmt.Errorf("close expects 1 argument, got %d", len(args)-1)) 413 + return &itemFalse{} 414 + } 415 + return g.makeItem(args[1]) 408 416 case "strings.MinRunes": 409 417 if len(args) != 2 { 410 418 g.addError(v, fmt.Errorf("strings.MinRunes expects 1 argument, got %d", len(args)-1))
+8 -32
encoding/jsonschema/testdata/external/tests/draft2020-12/const.json
··· 54 54 "data": { 55 55 "foo": "bar" 56 56 }, 57 - "valid": false, 58 - "skip": { 59 - "v3-roundtrip": "unexpected success" 60 - } 57 + "valid": false 61 58 }, 62 59 { 63 60 "description": "another type is invalid", ··· 65 62 1, 66 63 2 67 64 ], 68 - "valid": false, 69 - "skip": { 70 - "v3-roundtrip": "unexpected success" 71 - } 65 + "valid": false 72 66 } 73 67 ] 74 68 }, ··· 97 91 "data": [ 98 92 2 99 93 ], 100 - "valid": false, 101 - "skip": { 102 - "v3-roundtrip": "unexpected success" 103 - } 94 + "valid": false 104 95 }, 105 96 { 106 97 "description": "array with additional items is invalid", ··· 109 100 2, 110 101 3 111 102 ], 112 - "valid": false, 113 - "skip": { 114 - "v3-roundtrip": "unexpected success" 115 - } 103 + "valid": false 116 104 } 117 105 ] 118 106 }, ··· 268 256 "data": { 269 257 "a": 0 270 258 }, 271 - "valid": false, 272 - "skip": { 273 - "v3-roundtrip": "unexpected success" 274 - } 259 + "valid": false 275 260 }, 276 261 { 277 262 "description": "{\"a\": 0.0} is invalid", 278 263 "data": { 279 264 "a": 0.0 280 265 }, 281 - "valid": false, 282 - "skip": { 283 - "v3-roundtrip": "unexpected success" 284 - } 266 + "valid": false 285 267 } 286 268 ] 287 269 }, ··· 306 288 "data": { 307 289 "a": 1 308 290 }, 309 - "valid": false, 310 - "skip": { 311 - "v3-roundtrip": "unexpected success" 312 - } 291 + "valid": false 313 292 }, 314 293 { 315 294 "description": "{\"a\": 1.0} is invalid", 316 295 "data": { 317 296 "a": 1.0 318 297 }, 319 - "valid": false, 320 - "skip": { 321 - "v3-roundtrip": "unexpected success" 322 - } 298 + "valid": false 323 299 } 324 300 ] 325 301 },
+2 -8
encoding/jsonschema/testdata/external/tests/draft2020-12/enum.json
··· 45 45 { 46 46 "description": "something else is invalid", 47 47 "data": null, 48 - "valid": false, 49 - "skip": { 50 - "v3-roundtrip": "unexpected success" 51 - } 48 + "valid": false 52 49 }, 53 50 { 54 51 "description": "objects are deep compared", 55 52 "data": { 56 53 "foo": false 57 54 }, 58 - "valid": false, 59 - "skip": { 60 - "v3-roundtrip": "unexpected success" 61 - } 55 + "valid": false 62 56 }, 63 57 { 64 58 "description": "valid object matches",
+2 -8
encoding/jsonschema/testdata/external/tests/draft2020-12/ref.json
··· 640 640 { 641 641 "description": "do not evaluate the $ref inside the enum, matching any string", 642 642 "data": "this is a string", 643 - "valid": false, 644 - "skip": { 645 - "v3-roundtrip": "unexpected success" 646 - } 643 + "valid": false 647 644 }, 648 645 { 649 646 "description": "do not evaluate the $ref inside the enum, definition exact match", 650 647 "data": { 651 648 "type": "string" 652 649 }, 653 - "valid": false, 654 - "skip": { 655 - "v3-roundtrip": "unexpected success" 656 - } 650 + "valid": false 657 651 }, 658 652 { 659 653 "description": "match the enum exactly",