validator

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 7, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCannotCastToCallError = errors.New("cannot cast message to CallError")

Functions

This section is empty.

Types

type ValidationResult

type ValidationResult struct {
	// contains filtered or unexported fields
}

func NewValidationResult

func NewValidationResult() *ValidationResult

NewValidationResult creates a new ValidationResult with the given validity and errors.

func (*ValidationResult) AddError

func (v *ValidationResult) AddError(err string)

func (*ValidationResult) Errors

func (v *ValidationResult) Errors() []string

Errors returns a list of errors collected during validation.

func (*ValidationResult) IsValid

func (v *ValidationResult) IsValid() bool

IsValid returns true if the validation result is valid, false otherwise.

type Validator

type Validator struct {
	// contains filtered or unexported fields
}

func NewValidator

func NewValidator(logger *zap.Logger, registry schema_registry.SchemaRegistry) *Validator

func (*Validator) ValidateMessage

func (v *Validator) ValidateMessage(octx ocpp.OcppContext, message ocpp.Message) (*ValidationResult, error)

ValidateMessage validates the message. It checks if the message has an action, a payload, and a unique ID. It also validates the payload against the schema for the given OCPP version. When OcppContext.Vendor and/or OcppContext.Model are non-empty the registry attempts a vendor/model-specific schema first, falling back to the base OCPP spec schema.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL