Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllSaltboxConfigs ¶
AllSaltboxConfigs validates all Saltbox configuration files using YAML schemas
Types ¶
type APIValidationResult ¶
APIValidationResult holds the result of an async API validation
type AsyncAPIValidator ¶
AsyncAPIValidator function type for async API validation
type AsyncValidationContext ¶
type AsyncValidationContext struct {
// contains filtered or unexported fields
}
AsyncValidationContext manages async API validations
func NewAsyncValidationContext ¶
func NewAsyncValidationContext() *AsyncValidationContext
NewAsyncValidationContext creates a new async validation context
func (*AsyncValidationContext) AddAPIValidation ¶
func (ctx *AsyncValidationContext) AddAPIValidation(name string, validator AsyncAPIValidator, value any, config map[string]any)
AddAPIValidation adds an async API validation to be executed
func (*AsyncValidationContext) Wait ¶
func (ctx *AsyncValidationContext) Wait() []error
Wait waits for all async validations to complete and returns any errors
type CustomValidator ¶
CustomValidator function type for custom validation
type Schema ¶
type Schema struct {
Rules map[string]*SchemaRule
}
Schema holds validation rules
func LoadSchema ¶
LoadSchema loads a YAML schema file
func (*Schema) ValidateStructure ¶
ValidateStructure performs lightweight structure validation (checks for unknown fields, required fields, but skips type checking)
func (*Schema) ValidateWithTypeFlexibility ¶
ValidateWithTypeFlexibility performs full validation including custom validators but ignores type mismatches
func (*Schema) ValidateWithTypeFlexibilityAsync ¶
func (s *Schema) ValidateWithTypeFlexibilityAsync(config map[string]any) (*AsyncValidationContext, error)
ValidateWithTypeFlexibilityAsync performs validation with async API checks
type SchemaRule ¶
type SchemaRule struct {
Type string `yaml:"type"`
Required bool `yaml:"required"`
Format string `yaml:"format"`
MinLength int `yaml:"min_length"`
MaxLength int `yaml:"max_length"`
NotEquals any `yaml:"not_equals"`
RequiredWith []string `yaml:"required_with"`
RequiredWhenTrue []string `yaml:"required_when_true"`
ValidateWhenTrue []string `yaml:"validate_when_true"`
CustomValidator string `yaml:"custom_validator"`
Properties map[string]*SchemaRule `yaml:"properties"`
Items *SchemaRule `yaml:"items"` // For array validation
// Fields for example config generation
Description string `yaml:"description"` // Comment to display above the section
Example any `yaml:"example"` // Example value for this field
}
SchemaRule represents a validation rule for a field