...
1#path: a.item
2
3-- in.cue --
4import "encoding/yaml"
5
6a: {
7 for key, value in { test: _ } {
8 ("item"): foo: key
9 }
10 item: {}
11}
12
13encodeA: yaml.Marshal(a.item)
14
15b: {
16 for key, value in { test: _ } {
17 [string]: "": key
18 }
19 item: {}
20}
21
22encodeB: yaml.Marshal(b.item)
23
24-- out/definition --
25import "encoding/yaml"
26
27a: {
28 for key, value in {
29 test: _
30 } {
31 "item": {
32 foo: key
33 }
34 }
35 item: {}
36}
37encodeA: yaml.Marshal(a.item)
38b: {
39 for key, value in {
40 test: _
41 } {
42 [string]: {
43 "": key
44 }
45 }
46 item: {}
47}
48encodeB: yaml.Marshal(b.item)
49-- out/doc --
50[]
51[a]
52[a item]
53[a item foo]
54[encodeA]
55[b]
56[b item]
57[b item ""]
58[encodeB]
59-- out/value --
60== Simplified
61{
62 a: {
63 item: {
64 foo: "test"
65 }
66 }
67 encodeA: """
68 foo: test
69
70 """
71 b: {
72 item: {
73 "": "test"
74 }
75 }
76 encodeB: """
77 "": test
78
79 """
80}
81== Raw
82{
83 a: {
84 item: {
85 foo: "test"
86 }
87 }
88 encodeA: """
89 foo: test
90
91 """
92 b: {
93 item: {
94 "": "test"
95 }
96 }
97 encodeB: """
98 "": test
99
100 """
101}
102== Final
103{
104 a: {
105 item: {
106 foo: "test"
107 }
108 }
109 encodeA: """
110 foo: test
111
112 """
113 b: {
114 item: {
115 "": "test"
116 }
117 }
118 encodeB: """
119 "": test
120
121 """
122}
123== All
124{
125 a: {
126 item: {
127 foo: "test"
128 }
129 }
130 encodeA: """
131 foo: test
132
133 """
134 b: {
135 item: {
136 "": "test"
137 }
138 }
139 encodeB: """
140 "": test
141
142 """
143}
144== Eval
145{
146 a: {
147 item: {
148 foo: "test"
149 }
150 }
151 encodeA: """
152 foo: test
153
154 """
155 b: {
156 item: {
157 "": "test"
158 }
159 }
160 encodeB: """
161 "": test
162
163 """
164}
View as plain text