-
Originally opened by @fils in cuelang/cue#691 Thanks @mpvl for pointing me here.. I've new to cue so still having trouble understanding the following. Running:
I feel stupid asking.. but I simply have not been able to find how to declare that @id must be present. The inputs are testing.cue
minimal.json
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Original reply by @mpvl in cuelang/cue#691 (comment) You did the right thing. The error that you are getting means that there was no concrete value and thus a required field is missing, thereby implying a required field is missing. We are seriously contemplating adding a
making it explicit that a field is required. This should make the corresponding error message also clearer. One benefit is that required fields are typically rarer in API, so The transition would be fairly straightforward, as |
Beta Was this translation helpful? Give feedback.
Original reply by @mpvl in cuelang/cue#691 (comment)
You did the right thing. The error that you are getting means that there was no concrete value and thus a required field is missing, thereby implying a required field is missing.
We are seriously contemplating adding a
!
marker for fields so you could write:making it explicit that a field is required. This should make the corresponding error message also clearer. One benefit is that required fields are typically rarer in API, so
!
should not have to be used too much. In addition, it results in a somewhat better model that was we currently have with?
. For one, we would have be…