validate

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: May 16, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package validate hosts reusable validation primitives for FastConf.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewValidator

func NewValidator[T any](schema Schema) func(*T) error

NewValidator wraps a Schema into a FastConf-compatible validator function suitable for passing to fastconf.WithValidator[T]. When schema is nil the returned function always reports an error so misconfiguration is surfaced early instead of silently passing every reload.

Types

type Schema

type Schema interface {
	ValidateJSON(data []byte) error
}

Schema is the minimal contract a schema-style validator must satisfy. Implementations live in sub-modules so the parent fastconf module stays free of their heavy dependencies (cuelang.org/go, go-playground/validator, jsonschema engines, etc.).

ValidateJSON receives the canonical JSON encoding of the FastConf state and returns nil on success or a descriptive error on failure (paths to offending fields recommended).

Jump to

Keyboard shortcuts

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