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) GlobalSchemasDescription() string
- func (st *SchemaStorage) ModuleSchemasDescription() string
- func (st *SchemaStorage) Validate(valuesType SchemaType, moduleName string, values utils.Values) error
- func (st *SchemaStorage) ValidateConfigValues(moduleName string, values utils.Values) error
- func (st *SchemaStorage) ValidateModuleHelmValues(moduleName string, values utils.Values) error
- func (st *SchemaStorage) ValidateValues(moduleName string, values utils.Values) error
- type SchemaType
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 ¶
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 ¶
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 {
Schemas map[SchemaType]*spec.Schema
}
func NewSchemaStorage ¶
func NewSchemaStorage(configBytes, valuesBytes []byte) (*SchemaStorage, error)
func (*SchemaStorage) GlobalSchemasDescription ¶
func (st *SchemaStorage) GlobalSchemasDescription() string
GlobalSchemasDescription describes which global schemas are present in storage.
func (*SchemaStorage) ModuleSchemasDescription ¶
func (st *SchemaStorage) ModuleSchemasDescription() string
ModuleSchemasDescription describes which schemas are present in storage for the module.
func (*SchemaStorage) Validate ¶
func (st *SchemaStorage) Validate(valuesType SchemaType, moduleName string, values utils.Values) error
func (*SchemaStorage) ValidateConfigValues ¶
func (st *SchemaStorage) ValidateConfigValues(moduleName string, values utils.Values) error
func (*SchemaStorage) ValidateModuleHelmValues ¶
func (st *SchemaStorage) ValidateModuleHelmValues(moduleName string, values utils.Values) error
func (*SchemaStorage) ValidateValues ¶
func (st *SchemaStorage) ValidateValues(moduleName string, values utils.Values) error
type SchemaType ¶
type SchemaType string
const ( GlobalSchema SchemaType = "global" ModuleSchema SchemaType = "module" ConfigValuesSchema SchemaType = "config" ValuesSchema SchemaType = "values" HelmValuesSchema SchemaType = "helm" )