Documentation
¶
Index ¶
- Constants
- func GetContextObject[T any](o *Options) *T
- func NewMapKeyError(severity Severity, rule string, err error, core CoreModeler, ...) error
- func NewMapValueError(severity Severity, rule string, err error, core CoreModeler, ...) error
- func NewSliceError(severity Severity, rule string, err error, core CoreModeler, ...) error
- func NewValidationError(severity Severity, rule string, err error, node *yaml.Node) error
- func NewValidationErrorWithDocumentLocation(severity Severity, rule string, err error, node *yaml.Node, ...) error
- func NewValueError(severity Severity, rule string, err error, core CoreModeler, ...) error
- func RuleDescription(ruleID string) string
- func RuleHowToFix(ruleID string) string
- func RuleSummary(ruleID string) string
- func SortValidationErrors(allErrors []error)
- type CoreModeler
- type Error
- type Fix
- type MapKeyNodeGetter
- type MapValueNodeGetter
- type Option
- type Options
- type RuleInfo
- type Severity
- type SliceNodeGetter
- type TypeMismatchError
- type ValueNodeGetter
Constants ¶
View Source
const ( // Spec Validation Rules RuleValidationRequiredField = "validation-required-field" RuleValidationTypeMismatch = "validation-type-mismatch" RuleValidationDuplicateKey = "validation-duplicate-key" RuleValidationInvalidFormat = "validation-invalid-format" RuleValidationEmptyValue = "validation-empty-value" RuleValidationInvalidReference = "validation-invalid-reference" RuleValidationInvalidSyntax = "validation-invalid-syntax" RuleValidationInvalidSchema = "validation-invalid-schema" RuleValidationInvalidTarget = "validation-invalid-target" RuleValidationAllowedValues = "validation-allowed-values" RuleValidationMutuallyExclusiveFields = "validation-mutually-exclusive-fields" RuleValidationOperationNotFound = "validation-operation-not-found" RuleValidationOperationIdUnique = "validation-operation-id-unique" RuleValidationOperationParameters = "validation-operation-parameters" RuleValidationSchemeNotFound = "validation-scheme-not-found" RuleValidationTagNotFound = "validation-tag-not-found" RuleValidationSupportedVersion = "validation-supported-version" RuleValidationCircularReference = "validation-circular-reference" )
Variables ¶
This section is empty.
Functions ¶
func GetContextObject ¶
func NewMapKeyError ¶ added in v0.2.1
func NewMapKeyError(severity Severity, rule string, err error, core CoreModeler, node MapKeyNodeGetter, key string) error
func NewMapValueError ¶ added in v0.2.1
func NewMapValueError(severity Severity, rule string, err error, core CoreModeler, node MapValueNodeGetter, key string) error
func NewSliceError ¶ added in v0.2.1
func NewSliceError(severity Severity, rule string, err error, core CoreModeler, node SliceNodeGetter, index int) error
func NewValidationError ¶ added in v1.0.0
func NewValidationErrorWithDocumentLocation ¶ added in v1.16.0
func NewValidationErrorWithDocumentLocation(severity Severity, rule string, err error, node *yaml.Node, documentLocation string) error
NewValidationErrorWithDocumentLocation creates a validation error with document location metadata.
func NewValueError ¶ added in v0.2.1
func NewValueError(severity Severity, rule string, err error, core CoreModeler, node ValueNodeGetter) error
func RuleDescription ¶ added in v1.16.0
func RuleHowToFix ¶ added in v1.16.0
func RuleSummary ¶ added in v1.16.0
func SortValidationErrors ¶ added in v1.0.0
func SortValidationErrors(allErrors []error)
SortValidationErrors sorts the provided validation errors by line and column number lowest to highest.
Types ¶
type CoreModeler ¶ added in v0.2.1
type Error ¶
type Error struct {
UnderlyingError error
Node *yaml.Node
Severity Severity
Rule string
Fix Fix
// DocumentLocation is the absolute location (URL or file path) of the document
// where the error originated. Empty means the main document.
DocumentLocation string
}
Error represents a validation error and the line and column where it occurred TODO allow getting the JSON path for line/column for validation errors
func (Error) GetColumnNumber ¶ added in v1.0.0
func (Error) GetDocumentLocation ¶ added in v1.16.0
GetDocumentLocation returns the document location where the error originated.
func (Error) GetLineNumber ¶ added in v1.0.0
func (Error) GetSeverity ¶ added in v1.16.0
type MapKeyNodeGetter ¶ added in v1.7.12
MapKeyNodeGetter provides access to map key nodes for error reporting.
type MapValueNodeGetter ¶ added in v1.7.12
MapValueNodeGetter provides access to map value nodes for error reporting.
type Options ¶
func NewOptions ¶
type RuleInfo ¶ added in v1.16.0
func RuleInfoForID ¶ added in v1.16.0
type Severity ¶ added in v1.16.0
type Severity string
type SliceNodeGetter ¶ added in v1.7.12
SliceNodeGetter provides access to slice element nodes for error reporting.
type TypeMismatchError ¶ added in v0.2.2
func NewTypeMismatchError ¶ added in v0.2.2
func NewTypeMismatchError(parentName, msg string, args ...any) *TypeMismatchError
func (TypeMismatchError) Error ¶ added in v0.2.2
func (e TypeMismatchError) Error() string
Click to show internal directories.
Click to hide internal directories.