validator

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package validator is the entry point other code should call. It loads the embedded JSON schema for the requested kind, runs the data through santhosh-tekuri/jsonschema, and then layers any Go-coded rules on top. The orchestration lives here so CLI, tests, and third-party importers all see the same validation surface.

Index

Constants

View Source
const (
	KindPlugin      = schema.KindPlugin
	KindMarketplace = schema.KindMarketplace
)

Re-exported so callers only need to import internal/validator.

Variables

This section is empty.

Functions

This section is empty.

Types

type Kind

type Kind = schema.Kind

Kind identifies which embedded schema to apply.

type Options

type Options struct {
	// Kind selects plugin or marketplace schema.
	Kind Kind
	// Marketplace, if non-empty, layers that marketplace's rule overlay on
	// top of the base rule set (see rules.ForMarketplace).
	Marketplace string
	// File is a display path used only for error messages.
	File string
}

Options customises a single validation run.

type Validator

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

Validator wraps a compiled JSON schema and the rule set that go with it. Reuse a single Validator across many files to avoid re-compiling.

func New

func New() (*Validator, error)

New compiles both embedded schemas and returns a ready Validator.

func (*Validator) Validate

func (v *Validator) Validate(data []byte, opts Options) (*report.Report, error)

Validate runs the data through the selected schema, then the base rule set, then any marketplace overlay. The returned report is never nil.

Jump to

Keyboard shortcuts

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