cuelang.org/go@v0.10.1/cue/testdata/definitions/issue317.txtar (about) 1 # Allow otherField 2 3 -- in.cue -- 4 #T: { 5 #Schema: [_]: #D 6 concrete: #Schema 7 } 8 #D: { 9 fieldWithDefault: *0 | int 10 ... 11 } 12 s: #T & { 13 #Schema: { 14 foo: otherField: string 15 } 16 concrete: foo: otherField: "hello" 17 } 18 19 #Container: { 20 Env: [Name=string]: { 21 name: string 22 value: string 23 } 24 } 25 #Deployment: { 26 #Containers: [Name=string]: #Container 27 28 containers: [for c in #Containers {c}] // Problem is here. 29 } 30 Something: { 31 #Deployment 32 #Containers: { 33 // Does not allow entries other than value. Either add ... or embed 34 "a thing": Env: foobar: value: "foo" 35 } 36 } 37 x: Something & #Deployment 38 -- out/eval/stats -- 39 Leaks: 0 40 Freed: 52 41 Reused: 45 42 Allocs: 7 43 Retain: 0 44 45 Unifications: 46 46 Conjuncts: 122 47 Disjuncts: 52 48 -- out/eval -- 49 (struct){ 50 #T: (#struct){ 51 #Schema: (#struct){ 52 } 53 concrete: (#struct){ 54 } 55 } 56 #D: (#struct){ 57 fieldWithDefault: (int){ |(*(int){ 0 }, (int){ int }) } 58 } 59 s: (#struct){ 60 #Schema: (#struct){ 61 foo: (#struct){ 62 otherField: (string){ string } 63 fieldWithDefault: (int){ |(*(int){ 0 }, (int){ int }) } 64 } 65 } 66 concrete: (#struct){ 67 foo: (#struct){ 68 otherField: (string){ "hello" } 69 fieldWithDefault: (int){ |(*(int){ 0 }, (int){ int }) } 70 } 71 } 72 } 73 #Container: (#struct){ 74 Env: (#struct){ 75 } 76 } 77 #Deployment: (#struct){ 78 #Containers: (#struct){ 79 } 80 containers: (#list){ 81 } 82 } 83 Something: (#struct){ 84 #Containers: (#struct){ 85 "a thing": (#struct){ 86 Env: (#struct){ 87 foobar: (#struct){ 88 value: (string){ "foo" } 89 name: (string){ string } 90 } 91 } 92 } 93 } 94 containers: (#list){ 95 0: (#struct){ 96 Env: (#struct){ 97 foobar: (#struct){ 98 value: (string){ "foo" } 99 name: (string){ string } 100 } 101 } 102 } 103 } 104 } 105 x: (#struct){ 106 #Containers: (#struct){ 107 "a thing": (#struct){ 108 Env: (#struct){ 109 foobar: (#struct){ 110 value: (string){ "foo" } 111 name: (string){ string } 112 } 113 } 114 } 115 } 116 containers: (#list){ 117 0: (#struct){ 118 Env: (#struct){ 119 foobar: (#struct){ 120 value: (string){ "foo" } 121 name: (string){ string } 122 } 123 } 124 } 125 } 126 } 127 } 128 -- out/export -- 129 #T: { 130 #Schema: [_]: #D 131 concrete: #Schema 132 } 133 #D: { 134 fieldWithDefault: *0 | int 135 ... 136 } 137 s: #T & { 138 #Schema: { 139 foo: otherField: string 140 } 141 concrete: foo: otherField: "hello" 142 } 143 144 #Container: { 145 Env: [Name=string]: { 146 name: string 147 value: string 148 } 149 } 150 #Deployment: { 151 #Containers: [Name=string]: #Container 152 153 containers: [for c in #Containers {c}] // Problem is here. 154 } 155 Something: { 156 #Deployment 157 #Containers: { 158 // Does not allow entries other than value. Either add ... or embed 159 "a thing": Env: foobar: value: "foo" 160 } 161 } 162 x: Something & #Deployment 163 164 -- out/compile -- 165 --- in.cue 166 { 167 #T: { 168 #Schema: { 169 [_]: 〈2;#D〉 170 } 171 concrete: 〈0;#Schema〉 172 } 173 #D: { 174 fieldWithDefault: (*0|int) 175 ... 176 } 177 s: (〈0;#T〉 & { 178 #Schema: { 179 foo: { 180 otherField: string 181 } 182 } 183 concrete: { 184 foo: { 185 otherField: "hello" 186 } 187 } 188 }) 189 #Container: { 190 Env: { 191 [string]: { 192 name: string 193 value: string 194 } 195 } 196 } 197 #Deployment: { 198 #Containers: { 199 [string]: 〈2;#Container〉 200 } 201 containers: [ 202 for _, c in 〈1;#Containers〉 { 203 〈1;c〉 204 }, 205 ] 206 } 207 Something: { 208 〈1;#Deployment〉 209 #Containers: { 210 "a thing": { 211 Env: { 212 foobar: { 213 value: "foo" 214 } 215 } 216 } 217 } 218 } 219 x: (〈0;Something〉 & 〈0;#Deployment〉) 220 }