Replies: 3 comments 6 replies
-
I am also trying to validate an existing yaml file where the root-level-keys can be any string but have to have a special value. I came to the conclusion, that this is not so easy to do in cue. Therefore I use This creates a new file |
Beta Was this translation helpful? Give feedback.
-
@ostcar @myitcv @narqo
after which This is what is happening in your example. However, embeddings across files should only be allowed between files of the same package. The same holds for cross-file references. Files without a package clause (or Some of these concepts post-date the command so not all command have been brought in line with this behavior yet. |
Beta Was this translation helpful? Give feedback.
-
This discussion has been migrated to cue-lang/cue#738. For more details about CUE's migration to a new home, please see cue-lang/cue#1078. |
Beta Was this translation helpful? Give feedback.
-
Following the thread on Twitter /w @myitcv and @rogpeppe.
I'm trying to come up with schema in cue, that will help us with catching typos in the existing yaml configs.
Below is a simplified example of a config. This is a single yaml file, where the root-level key can a be any string, but the value must match a predefined struct.
The schema I use:
I expected, that running
cue vet
against the config, would raise the case about an extra fieldproduction_eu.stats.output1
(helping us to spot the typo). But the vet has no complains:If I change the schema, specifying the exact top-level keys, vet raises the error as I expected:
If I try to update the "shape" of the config, moving
testing
,production_eu
, etc keys under a single root-level key, vet also works as I expected it:Beta Was this translation helpful? Give feedback.
All reactions