engine

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CoerceMode

type CoerceMode string

CoerceMode specifies the coercion aggressiveness.

const (
	CoerceModeConservative CoerceMode = "conservative"
	CoerceModePermissive   CoerceMode = "permissive"
	CoerceModeOff          CoerceMode = "off"
)

type CoerceOptions

type CoerceOptions struct {
	Mode   CoerceMode
	DryRun bool
}

CoerceOptions configures coercion behavior.

type Finding

type Finding struct {
	Severity Severity `json:"severity"`
	Code     string   `json:"code"`
	Path     string   `json:"path"`
	Message  string   `json:"message"`
	Hint     string   `json:"hint,omitempty"`
	Rule     string   `json:"rule,omitempty"`
}

Finding represents a single validation or coercion finding.

type Report

type Report struct {
	Valid    bool      `json:"valid"`
	Findings []Finding `json:"findings"`
}

Report is the canonical output of validation or coercion.

func CoerceSchema

func CoerceSchema(profileID string, schemaFile string, metaSchemaYAML []byte, schemaBytes []byte, opts *CoerceOptions) ([]byte, *Report, bool, error)

CoerceSchema attempts to make a schema compliant with a profile. Returns the coerced schema bytes, a report of changes, and whether any changes were made.

func NewReport

func NewReport() *Report

NewReport creates a new empty report (valid by default).

func ValidateSchema

func ValidateSchema(profileID string, schemaFile string, metaSchemaYAML []byte, schemaBytes []byte, opts *ValidateOptions) (*Report, error)

ValidateSchema validates a candidate JSON Schema against a profile. It runs Phase 1 (meta-schema validation) and Phase 2 (provider-specific code checks).

func (*Report) AddFinding

func (r *Report) AddFinding(f Finding)

AddFinding adds a finding and updates validity.

func (*Report) HasErrors

func (r *Report) HasErrors() bool

HasErrors returns true if any finding has error severity.

func (*Report) HasWarnings

func (r *Report) HasWarnings() bool

HasWarnings returns true if any finding has warning severity.

func (*Report) JSON

func (r *Report) JSON() ([]byte, error)

JSON returns the JSON encoding of the report.

func (*Report) Sort

func (r *Report) Sort()

Sort sorts findings by path then code for deterministic output.

func (*Report) Text

func (r *Report) Text() string

Text returns a human-friendly text representation.

type SchemaMetrics

type SchemaMetrics struct {
	TotalProperties int
	MaxDepth        int
	TotalEnumValues int
	StringBudget    int
	LargeEnums      []largeEnum // enums with >250 values
}

SchemaMetrics holds computed metrics from a schema graph traversal.

type Severity

type Severity string

Severity represents the severity of a finding.

const (
	SeverityError   Severity = "error"
	SeverityWarning Severity = "warning"
	SeverityInfo    Severity = "info"
)

type ValidateOptions

type ValidateOptions struct {
	// Strict treats warnings as errors.
	Strict bool
	// ModelTarget applies additional model-specific restrictions (e.g. OpenAI fine-tuned).
	ModelTarget string
}

ValidateOptions configures validation behavior.

Jump to

Keyboard shortcuts

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