-
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: 2 comments 1 reply
-
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.
-
This discussion has been migrated to cue-lang/cue#872. For more details about CUE's migration to a new home, please see cue-lang/cue#1078. |
Beta Was this translation helpful? Give feedback.
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: