@@ -147,7 +147,7 @@ func schemas(g *Generator, inst cue.InstanceOrValue) (schemas *ast.StructLit, er
147
147
if ref == "" {
148
148
continue
149
149
}
150
- c .schemas .Set (ref , c .build (sel , i .Value ()))
150
+ c .schemas .setExpr (ref , c .build (sel , i .Value ()))
151
151
}
152
152
153
153
// keep looping until a fixed point is reached.
@@ -168,7 +168,7 @@ func schemas(g *Generator, inst cue.InstanceOrValue) (schemas *ast.StructLit, er
168
168
last := len (sels ) - 1
169
169
c .path = sels [:last ]
170
170
name := sels [last ]
171
- c .schemas .Set (ext .ref , c .build (name , cue .Dereference (ext .value )))
171
+ c .schemas .setExpr (ext .ref , c .build (name , cue .Dereference (ext .value )))
172
172
}
173
173
}
174
174
@@ -752,9 +752,9 @@ func (b *builder) object(v cue.Value) {
752
752
if ref == "" {
753
753
continue
754
754
}
755
- b .ctx .schemas .Set (ref , schema )
755
+ b .ctx .schemas .setExpr (ref , schema )
756
756
case ! b .isNonCore () || len (schema .Elts ) > 0 :
757
- properties .Set (label , schema )
757
+ properties .setExpr (label , schema )
758
758
}
759
759
}
760
760
@@ -1127,13 +1127,13 @@ func setType(t *oaSchema, b *builder) {
1127
1127
if b .typ != "" {
1128
1128
if b .core == nil || (b .core .typ != b .typ && ! b .ctx .structural ) {
1129
1129
if ! t .exists ("type" ) {
1130
- t .Set ("type" , ast .NewString (b .typ ))
1130
+ t .setExpr ("type" , ast .NewString (b .typ ))
1131
1131
}
1132
1132
}
1133
1133
}
1134
1134
if b .format != "" {
1135
1135
if b .core == nil || b .core .format != b .format {
1136
- t .Set ("format" , ast .NewString (b .format ))
1136
+ t .setExpr ("format" , ast .NewString (b .format ))
1137
1137
}
1138
1138
}
1139
1139
}
@@ -1156,7 +1156,7 @@ func (b *builder) setSingle(key string, v ast.Expr, drop bool) {
1156
1156
b .failf (cue.Value {}, "more than one value added for key %q" , key )
1157
1157
}
1158
1158
}
1159
- b .singleFields .Set (key , v )
1159
+ b .singleFields .setExpr (key , v )
1160
1160
}
1161
1161
1162
1162
func (b * builder ) set (key string , v ast.Expr ) {
@@ -1167,7 +1167,7 @@ func (b *builder) set(key string, v ast.Expr) {
1167
1167
b .current = & OrderedMap {}
1168
1168
b .allOf = append (b .allOf , (* ast .StructLit )(b .current ))
1169
1169
}
1170
- b .current .Set (key , v )
1170
+ b .current .setExpr (key , v )
1171
1171
}
1172
1172
1173
1173
func (b * builder ) kv (key string , value ast.Expr ) * ast.StructLit {
@@ -1208,14 +1208,14 @@ func (b *builder) finish() *ast.StructLit {
1208
1208
exprs = append (exprs , s )
1209
1209
}
1210
1210
t = & OrderedMap {}
1211
- t .Set ("allOf" , ast .NewList (exprs ... ))
1211
+ t .setExpr ("allOf" , ast .NewList (exprs ... ))
1212
1212
}
1213
1213
if b .singleFields != nil {
1214
1214
b .singleFields .Elts = append (b .singleFields .Elts , t .Elts ... )
1215
1215
t = b .singleFields
1216
1216
}
1217
1217
if b .deprecated {
1218
- t .Set ("deprecated" , ast .NewBool (true ))
1218
+ t .setExpr ("deprecated" , ast .NewBool (true ))
1219
1219
}
1220
1220
setType (t , b )
1221
1221
sortSchema ((* ast .StructLit )(t ))
0 commit comments