this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

encoding/openapi: rewrite uses of deprecated cue.Value methods

cue.Value.Reference can be rewritten with cue.Value.ReferencePath,
and cue.Value.Elem can be rewritten with cue.Value.LookupPath
with either cue.AnyString or cue.AnyIndex, depending on whether
the value is a struct or a list.

Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
Change-Id: I092707aafe89feb4dbf3e7fd9980f0deb73940a4
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1206354
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
Reviewed-by: Paul Jolly <paul@myitcv.io>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>

+7 -7
+3 -3
encoding/openapi/build.go
··· 378 378 default: 379 379 a := appendSplit(nil, cue.OrOp, v) 380 380 for i, v := range a { 381 - if _, r := v.Reference(); len(r) == 0 { 381 + if _, r := v.ReferencePath(); len(r.Selectors()) == 0 { 382 382 a[i] = v.Eval() 383 383 } 384 384 } ··· 750 750 b.setSingle("properties", (*ast.StructLit)(properties), false) 751 751 } 752 752 753 - if t, ok := v.Elem(); ok && 753 + if t := v.LookupPath(cue.MakePath(cue.AnyString)); t.Exists() && 754 754 (b.core == nil || b.core.items == nil) && b.checkCycle(t) { 755 755 schema := b.schema(nil, cue.AnyString, t) 756 756 if len(schema.Elts) > 0 { ··· 852 852 } 853 853 854 854 if !hasMax || int64(len(items)) < maxLength { 855 - if typ, ok := v.Elem(); ok && b.checkCycle(typ) { 855 + if typ := v.LookupPath(cue.MakePath(cue.AnyIndex)); typ.Exists() && b.checkCycle(typ) { 856 856 var core *builder 857 857 if b.core != nil { 858 858 core = b.core.items
+4 -4
encoding/openapi/crd.go
··· 113 113 defer b.popNode() 114 114 115 115 if !b.ctx.expandRefs { 116 - _, r := v.Reference() 117 - if len(r) > 0 { 116 + _, r := v.ReferencePath() 117 + if len(r.Selectors()) > 0 { 118 118 return 119 119 } 120 120 } ··· 128 128 129 129 switch b.kind { 130 130 case cue.StructKind: 131 - if typ, ok := v.Elem(); ok { 131 + if typ := v.LookupPath(cue.MakePath(cue.AnyString)); typ.Exists() { 132 132 if !b.checkCycle(typ) { 133 133 return 134 134 } ··· 140 140 b.buildCoreStruct(v) 141 141 142 142 case cue.ListKind: 143 - if typ, ok := v.Elem(); ok { 143 + if typ := v.LookupPath(cue.MakePath(cue.AnyIndex)); typ.Exists() { 144 144 if !b.checkCycle(typ) { 145 145 return 146 146 }