Drop all calls to IsEmpty.

This commit is contained in:
jregan
2020-08-09 10:39:04 -07:00
parent 2da8959198
commit 31c59bd7f2
14 changed files with 39 additions and 55 deletions

View File

@@ -51,7 +51,7 @@ func (l *Walker) walkAssociativeSequence() (*yaml.RNode, error) {
if err != nil {
return nil, err
}
if yaml.IsEmpty(val) || yaml.IsEmptyMap(val) {
if yaml.IsMissingOrNull(val) || yaml.IsEmptyMap(val) {
_, err = dest.Pipe(yaml.ElementSetter{Key: key, Value: value})
if err != nil {
return nil, err
@@ -74,7 +74,7 @@ func (l *Walker) walkAssociativeSequence() (*yaml.RNode, error) {
}
}
// field is empty
if yaml.IsEmpty(dest) {
if yaml.IsMissingOrNull(dest) {
return nil, nil
}
return dest, nil
@@ -97,7 +97,7 @@ func (l *Walker) walkAssociativeSequence() (*yaml.RNode, error) {
if err != nil {
return nil, err
}
if yaml.IsEmpty(val) {
if yaml.IsMissingOrNull(val) {
_, err = dest.Pipe(yaml.ElementSetter{Key: key, Value: value})
if err != nil {
return nil, err
@@ -121,7 +121,7 @@ func (l *Walker) walkAssociativeSequence() (*yaml.RNode, error) {
}
// field is empty
if yaml.IsEmpty(dest) {
if yaml.IsMissingOrNull(dest) {
return nil, nil
}
return dest, nil

View File

@@ -39,7 +39,7 @@ func (l Walker) walkMap() (*yaml.RNode, error) {
continue
}
field := l.Sources[i].Field(key)
if field == nil || yaml.IsEmpty(field.Key) {
if field == nil || yaml.IsMissingOrNull(field.Key) {
keys = append(keys, nil)
continue
}
@@ -148,7 +148,7 @@ func (l Walker) fieldValue(fieldName string) ([]*yaml.RNode, *openapi.ResourceSc
field := l.Sources[i].Field(fieldName)
f, s := l.valueIfPresent(field)
fields = append(fields, f)
if sch == nil && !s.IsEmpty() {
if sch == nil && !s.IsMissingOrNull() {
sch = s
}
}

View File

@@ -40,7 +40,7 @@ type Walker struct {
func (l Walker) Kind() yaml.Kind {
for _, s := range l.Sources {
if !yaml.IsEmpty(s) {
if !yaml.IsMissingOrNull(s) {
return s.YNode().Kind
}
}
@@ -83,7 +83,7 @@ func (l Walker) Walk() (*yaml.RNode, error) {
func (l Walker) GetSchema() *openapi.ResourceSchema {
for i := range l.Sources {
r := l.Sources[i]
if yaml.IsEmpty(r) {
if yaml.IsMissingOrNull(r) {
continue
}
@@ -106,7 +106,7 @@ func (l Walker) GetSchema() *openapi.ResourceSchema {
}
for i := range l.Sources {
r := l.Sources[i]
if yaml.IsEmpty(r) {
if yaml.IsMissingOrNull(r) {
continue
}