cue icon indicating copy to clipboard operation
cue copied to clipboard

Completely missing yaml map values cause unhelpful error message

Open cueckoo opened this issue 4 years ago • 1 comments

Originally opened by @zellyn in https://github.com/cuelang/cue/issues/262

When a map (or other) value is just completely missing in yaml files, cue vet prints only line numbers from the cue schema it is checking against. When vetting hundreds of files, this then requires some kind of manual binary search to find the offending yaml file.

mkdir cuetest
cd cuetest
echo -e 'foo:\n\n' > test.yaml
echo 'foo: {}' > test.cue
cue vet test.yaml test.cue
foo: invalid operation null & {} (mismatched types null and struct):
    -
    ./test.cue:1:6

cueckoo avatar Jul 03 '21 10:07 cueckoo

Original reply by @mpvl in https://github.com/cuelang/cue/issues/262#issuecomment-575132262

Interesting, the issue here is that the map has no token, and thus no position. Hopefully the move to yaml.v3 will fix this.

cueckoo avatar Jul 03 '21 10:07 cueckoo