List and set setters in folders recursively

This commit is contained in:
Phani Teja Marupaka
2020-07-20 00:50:04 -07:00
parent 45eed23b26
commit 108195185f
9 changed files with 153 additions and 60 deletions

View File

@@ -34,6 +34,8 @@ type Set struct {
SetAll bool
}
const SetterNotFoundWarn = "unable to find setter with name "
// Filter implements Set as a yaml.Filter
func (s *Set) Filter(object *yaml.RNode) (*yaml.RNode, error) {
return object, accept(s, object)
@@ -328,14 +330,14 @@ func (s SetOpenAPI) Filter(object *yaml.RNode) (*yaml.RNode, error) {
return nil, err
}
if oa == nil {
return nil, errors.Errorf("no setter %s found", s.Name)
return nil, errors.Errorf(SetterNotFoundWarn + s.Name)
}
def, err := oa.Pipe(yaml.Lookup("x-k8s-cli", "setter"))
if err != nil {
return nil, err
}
if def == nil {
return nil, errors.Errorf("no setter %s found", s.Name)
return nil, errors.Errorf(SetterNotFoundWarn + s.Name)
}
// record the OpenAPI type for the setter

View File

@@ -1209,7 +1209,7 @@ openAPI:
{
name: "error",
setter: "replicas",
err: "no setter replicas found",
err: "unable to find setter with name replicas",
input: `
openAPI:
definitions: