Validate substitutions against openAPI

This commit is contained in:
Phani Teja Marupaka
2020-05-14 14:00:58 -07:00
parent ff125b8c6c
commit 7c731f0109
2 changed files with 97 additions and 0 deletions

View File

@@ -133,6 +133,10 @@ func (s *Set) substitute(field *yaml.RNode, ext *cliExtension, _ *spec.Schema) (
return false, errors.Wrap(err)
}
if err := validateAgainstSchema(subSetter, setter); err != nil {
return false, err
}
if val, found := subSetter.Setter.EnumValues[subSetter.Setter.Value]; found {
// the setter has an enum-map. we should replace the marker with the
// enum value looked up from the map rather than the enum key