Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions pkg/yaml/validation/extensions.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package validation

import (
"encoding/json"
"errors"
"fmt"

"github.com/go-openapi/spec"
Expand All @@ -26,6 +27,10 @@ const (
xRulesExtension = "x-rules"
)

var (
ErrValidationRuleFailed = errors.New("validation rule failed")
)

type (
ExtensionsValidatorHandler func(oldValue json.RawMessage) error
)
Expand Down Expand Up @@ -132,3 +137,7 @@ func (v *ExtensionsValidator) validateData(data json.RawMessage, schema spec.Sch

return nil
}

func NewExtensionsRuleError(msg string, err error) error {
return fmt.Errorf("%w: %s: %w", ErrValidationRuleFailed, msg, err)
}
Loading