Skip to content

Commit d170b1c

Browse files
committed
cue: advance deprecation of Iterator methods
Iterator.Label had been hidden and slated for deprecation since 2021, so it's time to formally deprecate it now. Iterator.IsHidden and Iterator.IsDefinition have been hidden and deprecated since 2021, so they can be removed at this point. Signed-off-by: Daniel Martí <[email protected]> Change-Id: I1a236ff0e26d145010f291f2e30310e2b0af0670 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1202284 TryBot-Result: CUEcueckoo <[email protected]> Unity-Result: CUE porcuepine <[email protected]> Reviewed-by: Roger Peppe <[email protected]>
1 parent 44cceca commit d170b1c

File tree

2 files changed

+2
-16
lines changed

2 files changed

+2
-16
lines changed

cue/types.go

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ func (i *Iterator) Selector() Selector {
259259
// Label reports the label of the value if i iterates over struct fields and ""
260260
// otherwise.
261261
//
262-
// Slated to be deprecated: use [Iterator.Selector] and [Selector.String].
262+
// Deprecated: use [Iterator.Selector] and [Selector.String].
263263
// Note that this will give more accurate string representations.
264264
func (i *hiddenIterator) Label() string {
265265
if i.f == 0 {
@@ -268,13 +268,6 @@ func (i *hiddenIterator) Label() string {
268268
return i.idx.LabelStr(i.f)
269269
}
270270

271-
// IsHidden reports if a field is hidden from the data model.
272-
//
273-
// Deprecated: use i.Selector().PkgPath() != ""
274-
func (i *hiddenIterator) IsHidden() bool {
275-
return i.f.IsHidden()
276-
}
277-
278271
// IsOptional reports if a field is optional.
279272
func (i *Iterator) IsOptional() bool {
280273
return i.arcType == adt.ArcOptional
@@ -285,13 +278,6 @@ func (i *Iterator) FieldType() SelectorType {
285278
return featureToSelType(i.f, i.arcType)
286279
}
287280

288-
// IsDefinition reports if a field is a definition.
289-
//
290-
// Deprecated: use i.Selector().IsDefinition()
291-
func (i *hiddenIterator) IsDefinition() bool {
292-
return i.f.IsDef()
293-
}
294-
295281
// marshalJSON iterates over the list and generates JSON output. HasNext
296282
// will return false after this operation.
297283
func listAppendJSON(b []byte, l *Iterator) ([]byte, error) {

encoding/openapi/openapi.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ func (c *Config) compose(inst cue.InstanceOrValue, schemas *ast.StructLit) (x *a
146146
var info *ast.StructLit
147147

148148
for i, _ := val.Fields(cue.Definitions(true)); i.Next(); {
149-
if i.IsDefinition() {
149+
if i.Selector().IsDefinition() {
150150
continue
151151
}
152152
label := i.Label()

0 commit comments

Comments
 (0)