Documentation
¶
Overview ¶
Package protoschema generates a JSON Schema describing the vix daemon⇄client wire protocol by reflecting over the payload structs registered in internal/protocol (protocol.EventTypes / protocol.CommandTypes).
The generated schema is the machine-readable contract that downstream clients (e.g. the native macOS app under apps/vix-mac) consume to stay in lockstep with the Go structs. cmd/protoschema writes it to internal/protocol/schema/vix-protocol.schema.json; a test in this package fails when the committed file drifts from the generator output.
Index ¶
Constants ¶
const SchemaURI = "https://json-schema.org/draft/2020-12/schema"
SchemaURI is the JSON Schema dialect the generated document declares.
Variables ¶
This section is empty.
Functions ¶
func Generate ¶
Generate builds the full protocol schema and returns it as indented JSON with a trailing newline. Output is deterministic (encoding/json sorts map keys), so it is safe to diff against a committed golden file.
func GenerateSwift ¶
GenerateSwift emits Swift `Codable` structs for every type in the protocol schema's $defs, derived from the same buildDoc() walk as the JSON schema. The output is a single self-contained file that depends only on the hand-written JSONValue support type (Sources/VixProtocol/JSONValue.swift) and Foundation.
The Go structs → schema → Swift chain is fully mechanical: a committed-file drift test on both outputs keeps the Swift models in lockstep with the daemon.
func ValidateCommand ¶
ValidateCommand is the client→daemon analog of ValidateEvent.
func ValidateEvent ¶
ValidateEvent checks that a daemon→client event's data payload conforms to the generated schema for its discriminator. A nil data (payload-less event such as event.agent_done) is accepted only for events registered without a payload.
func ValidateRPC ¶
ValidateRPC checks that an RPC projection value (keyed by type name, e.g. "ThreadSummary") conforms to the generated schema.
Types ¶
This section is empty.