validation

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package validation provides runtime validation of events against schemas.

The Validator checks that incoming event payloads match the schema definition before they are published to Redpanda. This prevents invalid data from entering the system.

Validation includes:

  • Required field presence
  • Field type correctness
  • Enum value constraints

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Validator

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

Validator validates events against a schema

func NewValidator

func NewValidator(schemaPath string) (*Validator, error)

NewValidator creates a validator from a schema file

func NewValidatorFromBytes

func NewValidatorFromBytes(schemaData []byte) (*Validator, error)

NewValidatorFromBytes creates a validator from schema YAML bytes

func (*Validator) EventTypeExists

func (v *Validator) EventTypeExists(eventType string) bool

EventTypeExists checks if an event type is defined in the schema

func (*Validator) GetEventTypes

func (v *Validator) GetEventTypes() []string

GetEventTypes returns all event types defined in the schema

func (*Validator) ValidateEvent

func (v *Validator) ValidateEvent(eventType string, payload map[string]interface{}) error

ValidateEvent validates an event payload against the schema

Jump to

Keyboard shortcuts

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