blob: 03e25bfa345e64a3010d3842c4801c728ed63113 [file] [log] [blame] [view]
Marcel van Lohuizen75cb0032019-01-11 12:10:48 +01001[TOC](Readme.md) [Prev](aliases.md) [Next](hidden.md)
2
Marcel van Lohuizenaf0932f2019-01-11 13:03:56 +01003_References and Visibility_
4
Marcel van Lohuizen75cb0032019-01-11 12:10:48 +01005# Emit Values
6
7By default all top-level fields are emitted when evaluating a configuration.
8CUE files may define a top-level value that is emitted instead.
Jonathan Amsterdame4790382019-01-20 10:29:29 -05009<!-- jba:
10It's unclear how they do that. Is it the first form in the file?
11And this is not in the spec AFAICT.
12-->
Marcel van Lohuizen75cb0032019-01-11 12:10:48 +010013
14Values within the emit value may refer to fields defined outside of it.
15
16Emit values allow CUE configurations, like JSON,
17to define any type, instead of just structs, while keeping the common case
18of defining structs light.
19
20<!-- CUE editor -->
21```
22{
23 a: A
24 b: B
25}
26
27A: 1
28B: 2
29```
30
31<!-- result -->
32```
33a: 1
34b: 2
Jonathan Amsterdame4790382019-01-20 10:29:29 -050035```