-
Originally opened by @rawkode in cuelang/cue#872 I have a Go application that uses Cue to validate the users YAML files. I store the Cue in Go as a hard coded string. However, I want to allow the user to provide extensions to the schema, which I am loading into a Go variable as well. The code looks like: var model = make(map[string]interface{})
// "cue" is a Cue string
err := cuego.Constrain(&model, cue)
if err != nil {
return nil, cueutils.UsefulError(err)
}
bytes, err := ioutil.ReadFile(path)
if err != nil {
return nil, cueutils.UsefulError(err)
}
err = yaml.Unmarshal(bytes, &model)
if err != nil {
return nil, cueutils.UsefulError(err)
}
err = cuego.Complete(&model)
if err != nil {
return nil, cueutils.UsefulError(err)
} I'd like to be able to "merge" the Examples of cue := `{
first_name: string
}`
extends := `{
last_name: string
}` I was really hoping |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Original reply by @mpvl in cuelang/cue#872 (comment) Note entirely sure what your flow is, but could you not just call In general CUE, not using
|
Beta Was this translation helpful? Give feedback.
Original reply by @mpvl in cuelang/cue#872 (comment)
Note entirely sure what your flow is, but could you not just call
Constrain
repeatedly for the same value?In general CUE, not using
cuego
, one could useFillPath
orUnify
for this purpose: