validator

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArgType

type ArgType int

ArgType represents the expected type of an argument

const (
	AnyType ArgType = iota
	NumberType
	StringType
	BooleanType
	ArrayType
	ObjectType
	VariableType
)

type OperatorSpec

type OperatorSpec struct {
	Name        string
	MinArgs     int
	MaxArgs     int
	ArgTypes    []ArgType
	Description string
}

OperatorSpec defines the specification for an operator

type ValidationError

type ValidationError struct {
	Operator string
	Message  string
	Path     string
}

ValidationError represents a validation error with context

func (ValidationError) Error

func (e ValidationError) Error() string

type Validator

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

Validator validates JSON Logic expressions

func NewValidator

func NewValidator() *Validator

NewValidator creates a new validator with all supported operators

func (*Validator) GetSupportedOperators

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

GetSupportedOperators returns a list of all supported operators

func (*Validator) IsOperatorSupported

func (v *Validator) IsOperatorSupported(operator string) bool

IsOperatorSupported checks if an operator is supported

func (*Validator) Validate

func (v *Validator) Validate(logic interface{}) error

Validate validates a JSON Logic expression

Jump to

Keyboard shortcuts

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