validate

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package validate contains Validator implementations.

Index

Constants

View Source
const RecordedOutputKey = "__recorded_output"

RecordedOutputKey is the key used to store the pre-recored output in the input itself. It can be used to handle pre-computed runs.

Variables

This section is empty.

Functions

func JSON

func JSON[Input any](schema []byte) func(_ context.Context, input any) error

JSON creates a JSON validator. If nil is passed as schema, the validator will try to read schema.json in the current directory. If that file does not exist, no validation will be performed.

Types

type JSONValidator

type JSONValidator[Input any] struct {
	// contains filtered or unexported fields
}

JSONValidator validates the input against a JSON schema.

func (JSONValidator[Input]) Validate

func (j JSONValidator[Input]) Validate(_ context.Context, input any) (retErr error)

Validate validates the input against a JSON schema.

Jump to

Keyboard shortcuts

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