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

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