Documentation
¶
Overview ¶
Package schema provides the plan schema for proactive architecture validation.
Package schema provides centralized JSON schema versioning and validation for AILANG's AI-first features.
Index ¶
Constants ¶
const ( ErrorV1 = "ailang.error/v1" TestV1 = "ailang.test/v1" DecisionsV1 = "ailang.decisions/v1" PlanV1 = "ailang.plan/v1" EffectsV1 = "ailang.effects/v1" )
Schema version constants
Variables ¶
var CompactMode = false
Compact option for JSON output
Functions ¶
func Accepts ¶
Accepts checks if a schema version is compatible with the expected version. Supports forward compatibility within major versions (e.g., v1.x accepts v1.0).
func FormatJSON ¶
FormatJSON formats JSON according to compact mode setting
func MarshalDeterministic ¶
MarshalDeterministic marshals a value to JSON with sorted keys for deterministic output.
func MustValidate ¶
MustValidate validates a value against a schema. Currently a no-op placeholder for future schema validation.
func SetCompactMode ¶
func SetCompactMode(enabled bool)
SetCompactMode enables or disables compact JSON output
Types ¶
type FuncPlan ¶
type FuncPlan struct {
Name string `json:"name"` // Function name
Type string `json:"type"` // Type signature (e.g., "int -> int")
Effects []string `json:"effects,omitempty"` // Effects (e.g., ["IO", "FS"])
Module string `json:"module"` // Module path where function is defined
}
FuncPlan describes a function signature
type ModulePlan ¶
type ModulePlan struct {
Path string `json:"path"` // e.g., "myapp/core"
Exports []string `json:"exports"` // Names of exported items
Imports []string `json:"imports"` // Import paths (e.g., "std/io")
}
ModulePlan describes a module's structure
type Plan ¶
type Plan struct {
Schema string `json:"schema"` // "ailang.plan.v1"
Goal string `json:"goal"` // Human-readable goal
Modules []ModulePlan `json:"modules"` // Module structure
Types []TypePlan `json:"types"` // Type definitions
Functions []FuncPlan `json:"functions"` // Function signatures
Effects []string `json:"effects,omitempty"` // Effects used across modules
Dependencies []string `json:"dependencies,omitempty"` // External dependencies
}
Plan represents a structured architecture plan for validation and scaffolding
func PlanFromJSON ¶
FromJSON loads a plan from JSON bytes
func (*Plan) AddFunction ¶
AddFunction adds a function signature to the plan
type TypePlan ¶
type TypePlan struct {
Name string `json:"name"` // Type name (e.g., "Option")
Kind string `json:"kind"` // "adt", "record", "alias"
Definition string `json:"definition"` // AILANG type syntax
Module string `json:"module"` // Module path where type is defined
}
TypePlan describes a type to be defined