Documentation
¶
Overview ¶
Package load provides utilities to read the ACP JSON schema and accompanying metadata into minimal structures used by the generator.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MergeStableAndUnstable ¶
func MergeStableAndUnstable(stableMeta *Meta, stableSchema *Schema, unstableMeta *Meta, unstableSchema *Schema) (*Meta, *Schema, error)
MergeStableAndUnstable combines stable and unstable schema inputs without mutating either.
The merged output keeps all stable definitions and method maps unchanged, while adding:
- Unstable-only methods (present only in unstable meta)
- Unstable-only $defs copied from the unstable schema under an "Unstable" prefix
Unstable-only RPC root types (Request/Response/Notification) are always copied with the Unstable prefix to avoid changing the stable API surface.
Types ¶
type Definition ¶
type Definition struct {
Description string `json:"description"`
Type any `json:"type"`
Properties map[string]*Definition `json:"properties"`
Required []string `json:"required"`
Enum []any `json:"enum"`
Items *Definition `json:"items"`
Ref string `json:"$ref"`
AnyOf []*Definition `json:"anyOf"`
OneOf []*Definition `json:"oneOf"`
AllOf []*Definition `json:"allOf"`
DocsIgnore bool `json:"x-docs-ignore"`
Title string `json:"title"`
Const any `json:"const"`
XSide string `json:"x-side"`
XMethod string `json:"x-method"`
// Default holds the JSON Schema default value, when present.
// Used by generators to synthesize defaulting behavior.
Default any `json:"default"`
// Discriminator specifies which property name distinguishes union variants.
// Part of JSON Schema's discriminator object support.
Discriminator *Discriminator `json:"discriminator,omitempty"`
// contains filtered or unexported fields
}
Definition is a partial JSON Schema node the generator cares about.
func (*Definition) UnmarshalJSON ¶
func (d *Definition) UnmarshalJSON(b []byte) error
UnmarshalJSON allows Definition to decode both object and boolean JSON Schema forms.
type Discriminator ¶
type Discriminator struct {
PropertyName string `json:"propertyName"`
}
Discriminator specifies which property distinguishes union variants. Part of JSON Schema discriminator object support.
type Meta ¶
type Meta struct {
Version int `json:"version"`
AgentMethods map[string]string `json:"agentMethods"`
ClientMethods map[string]string `json:"clientMethods"`
ProtocolMethods map[string]string `json:"protocolMethods,omitempty"`
}
Meta mirrors schema/meta.json for method maps and version.
type Schema ¶
type Schema struct {
Defs map[string]*Definition `json:"$defs"`
}
Schema is a minimal view over schema/schema.json definitions used by the generator.
func ReadSchema ¶
ReadSchema loads schema/schema.json.