Replies: 5 comments 7 replies
-
Original reply by @verdverm in cuelang/cue#842 (comment) This does not match what I see. To get the error you describe, you have to supply the Are you doing the equivalent in the Go version? |
Beta Was this translation helpful? Give feedback.
-
Original reply by @dinhxuanvu in cuelang/cue#842 (comment)
Hey @verdverm. Thank you for your response. You're correct. For the
There is no error reported. However, if the
It will error out: |
Beta Was this translation helpful? Give feedback.
-
Original reply by @verdverm in cuelang/cue#842 (comment) You probably want to do something like:
I suspect that you have an non-existent value after your lookup. You could also try making the key |
Beta Was this translation helpful? Give feedback.
-
Original reply by @myitcv in cuelang/cue#842 (comment) @dinhxuanvu I've migrated this to be a discussion because I'm not clear there's an issue/bug right now, given what's described above. We can of course create issues for bugs/other that come from this discussion. |
Beta Was this translation helpful? Give feedback.
-
Original reply by @mpvl in cuelang/cue#842 (comment) See also the #822. In general, people seem to want the behavior of ignoring inconcrete values when exporting, and instead be explicit if a value should be required. This is because in large APIs most fields tend to be optional. |
Beta Was this translation helpful? Give feedback.
-
Originally opened by @dinhxuanvu in cuelang/cue#842
What version of CUE are you using (
cue version
)?Does this issue reproduce with the latest release?
Yes
What did you do?
I have a cue file with some definitions and a JSON file that I would like to run validation against the constraints that are specified in that cue file. I use both cue CLI and cue library to perform this task.
schema.cue
test.json
What did you expect to see?
I would expect both cue CLI and library would behave the same in term of validation.
What did you see instead?
When I run
cue vet test.json schema.cue
, it will complainname: incomplete value !=""
as expected. However, when I useValidate(b []byte, v cue.Value)
fromencoding/json
in go code, there is no error.I wonder if this is expected behavior or a bug.
Beta Was this translation helpful? Give feedback.
All reactions