-
Originally opened by @joanlopez in cuelang/cue#810 Hi folks! I'm trying to add support for Cue validations into another Go tool, so basically I'm wondering how I can perform data validations programatically. Let's say in a similar way I'd run the How can I achieve something similar programatically, considering, for example, I have the bytes of each file in a variable? Thanks!! 🙏🏻 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Original reply by @mpvl in cuelang/cue#810 (comment) There is an extensive API for this. See Validation is typically done by getting two You can also validate Go values directly. See |
Beta Was this translation helpful? Give feedback.
Original reply by @mpvl in cuelang/cue#810 (comment)
There is an extensive API for this. See
cuelang.org/go/cue
,cuelang.org/go/cue/load
and friends.Validation is typically done by getting two
cue.Value
s and unify them usingcue.Unify
. TheValidate
method allows you to be more specific about which errors to get.You can also validate Go values directly. See
cuelang.org/go/encoding/gocode
.