Documentation ¶
Index ¶
- func ApplyDefaults(obj interface{}, s *spec.Schema) bool
- func LoadSchemaFromBytes(openApiContent []byte) (*spec.Schema, error)
- func PrepareSchemas(configBytes, valuesBytes []byte) (schemas map[SchemaType]*spec.Schema, err error)
- func YAMLBytesToJSONDoc(data []byte) (json.RawMessage, error)
- func YAMLDocLoader(path string) (json.RawMessage, error)
- type SchemaStorage
- func (st *SchemaStorage) AddGlobalValuesSchemas(configBytes, valuesBytes []byte) error
- func (st *SchemaStorage) AddModuleValuesSchemas(moduleName string, configBytes, valuesBytes []byte) error
- func (st *SchemaStorage) GlobalSchemasDescription() string
- func (st *SchemaStorage) GlobalValuesSchema(schemaType SchemaType) *spec.Schema
- func (st *SchemaStorage) ModuleSchemasDescription(moduleName string) string
- func (st *SchemaStorage) ModuleValuesSchema(moduleName string, schemaType SchemaType) *spec.Schema
- type SchemaType
- type ValuesValidator
- func (v *ValuesValidator) GetSchema(schemaType SchemaType, valuesType SchemaType, modName string) *spec.Schema
- func (v *ValuesValidator) ValidateGlobalConfigValues(values utils.Values) error
- func (v *ValuesValidator) ValidateGlobalValues(values utils.Values) error
- func (v *ValuesValidator) ValidateModuleConfigValues(moduleName string, values utils.Values) error
- func (v *ValuesValidator) ValidateModuleHelmValues(moduleName string, values utils.Values) (multiErr error)
- func (v *ValuesValidator) ValidateModuleValues(moduleName string, values utils.Values) (multiErr error)
- func (v *ValuesValidator) ValidateValues(schemaType SchemaType, valuesType SchemaType, moduleName string, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyDefaults ¶
ApplyDefaults traverses an object and apply default values from OpenAPI schema. It returns true if obj is changed.
Note: check only Properties for object type and List validation for array type.
func LoadSchemaFromBytes ¶
LoadSchemaFromBytes returns spec.Schema object loaded from YAML bytes.
func PrepareSchemas ¶
func PrepareSchemas(configBytes, valuesBytes []byte) (schemas map[SchemaType]*spec.Schema, err error)
PrepareSchemas loads schemas for config values, values and helm values.
func YAMLBytesToJSONDoc ¶ added in v1.1.0
func YAMLBytesToJSONDoc(data []byte) (json.RawMessage, error)
YAMLBytesToJSONDoc is a replacement of swag.YAMLData and YAMLDoc to Unmarshal into interface{}. swag.BytesToYAML uses yaml.MapSlice to unmarshal YAML. This type doesn't support map merge of YAML anchors.
func YAMLDocLoader ¶ added in v1.1.0
func YAMLDocLoader(path string) (json.RawMessage, error)
YAMLDocLoader loads a yaml document from either http or a file and converts it to json.
Types ¶
type SchemaStorage ¶
type SchemaStorage struct { GlobalSchemas map[SchemaType]*spec.Schema ModuleSchemas map[string]map[SchemaType]*spec.Schema }
func NewSchemaStorage ¶
func NewSchemaStorage() *SchemaStorage
func (*SchemaStorage) AddGlobalValuesSchemas ¶
func (st *SchemaStorage) AddGlobalValuesSchemas(configBytes, valuesBytes []byte) error
AddGlobalValuesSchemas prepares and stores three schemas: config, config+values, config+values+required.
func (*SchemaStorage) AddModuleValuesSchemas ¶
func (st *SchemaStorage) AddModuleValuesSchemas(moduleName string, configBytes, valuesBytes []byte) error
AddModuleValuesSchemas creates schema for module values.
func (*SchemaStorage) GlobalSchemasDescription ¶ added in v1.0.6
func (st *SchemaStorage) GlobalSchemasDescription() string
GlobalSchemasDescription describes which global schemas are present in storage.
func (*SchemaStorage) GlobalValuesSchema ¶
func (st *SchemaStorage) GlobalValuesSchema(schemaType SchemaType) *spec.Schema
GlobalValuesSchema returns ready-to-use schema for global values. schemaType is "config", "values" or "helm"
func (*SchemaStorage) ModuleSchemasDescription ¶ added in v1.0.6
func (st *SchemaStorage) ModuleSchemasDescription(moduleName string) string
ModuleSchemasDescription describes which schemas are present in storage for the module.
func (*SchemaStorage) ModuleValuesSchema ¶
func (st *SchemaStorage) ModuleValuesSchema(moduleName string, schemaType SchemaType) *spec.Schema
ModuleValuesSchema returns ready-to-use schema for module values. schemaType is "config" of "values"
type SchemaType ¶
type SchemaType string
const ( GlobalSchema SchemaType = "global" ModuleSchema SchemaType = "module" ConfigValuesSchema SchemaType = "config" ValuesSchema SchemaType = "values" HelmValuesSchema SchemaType = "helm" )
type ValuesValidator ¶
type ValuesValidator struct {
SchemaStorage *SchemaStorage
}
func NewValuesValidator ¶
func NewValuesValidator() *ValuesValidator
func (*ValuesValidator) GetSchema ¶ added in v1.1.0
func (v *ValuesValidator) GetSchema(schemaType SchemaType, valuesType SchemaType, modName string) *spec.Schema
GetSchema returns a schema from the schema storage.
func (*ValuesValidator) ValidateGlobalConfigValues ¶
func (v *ValuesValidator) ValidateGlobalConfigValues(values utils.Values) error
func (*ValuesValidator) ValidateGlobalValues ¶
func (v *ValuesValidator) ValidateGlobalValues(values utils.Values) error
func (*ValuesValidator) ValidateModuleConfigValues ¶
func (v *ValuesValidator) ValidateModuleConfigValues(moduleName string, values utils.Values) error
func (*ValuesValidator) ValidateModuleHelmValues ¶
func (v *ValuesValidator) ValidateModuleHelmValues(moduleName string, values utils.Values) (multiErr error)
func (*ValuesValidator) ValidateModuleValues ¶
func (v *ValuesValidator) ValidateModuleValues(moduleName string, values utils.Values) (multiErr error)
func (*ValuesValidator) ValidateValues ¶
func (v *ValuesValidator) ValidateValues(schemaType SchemaType, valuesType SchemaType, moduleName string, values utils.Values) error