Setters: support for explicit setter typing

- ensure OpenAPI definitions always uses strings for setter values
- allow the field type to be defined -- integer,boolean,string
- format values using yaml 1.1 compatibility
This commit is contained in:
Phillip Wittrock
2020-02-27 11:49:59 -08:00
parent da548f65ea
commit fa507f782f
6 changed files with 167 additions and 21 deletions

View File

@@ -19,6 +19,8 @@ type SetterCreator struct {
SetBy string
Type string
// FieldName if set will add the OpenAPI reference to fields with this name or path
// FieldName may be the full name of the field, full path to the field, or the path suffix.
// e.g. all of the following would match spec.template.spec.containers.image --
@@ -35,7 +37,9 @@ type SetterCreator struct {
func (c SetterCreator) Create(openAPIPath, resourcesPath string) error {
// Update the OpenAPI definitions to hace the setter
sd := setters2.SetterDefinition{
Name: c.Name, Value: c.FieldValue, Description: c.Description, SetBy: c.SetBy}
Name: c.Name, Value: c.FieldValue, Description: c.Description, SetBy: c.SetBy,
Type: c.Type,
}
if err := sd.AddToFile(openAPIPath); err != nil {
return err
}