Documentation
¶
Index ¶
- func IsRequired(tool Tool, property string) bool
- func SnapshotDigest(data []byte) string
- func SortedProperties(tool Tool) []string
- func ValidateCoverage(snapshot Snapshot, snapshotData []byte, manifest Manifest) error
- type Annotations
- type JSONSchema
- type Manifest
- type Property
- type Resource
- type ResourceMapping
- type Snapshot
- type Tool
- type ToolMapping
- type ValidationError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsRequired ¶
func SnapshotDigest ¶
func SortedProperties ¶
Types ¶
type Annotations ¶
type JSONSchema ¶
type JSONSchema struct {
Schema string `json:"$schema,omitempty"`
Type string `json:"type,omitempty"`
Description string `json:"description,omitempty"`
Properties map[string]Property `json:"properties,omitempty"`
Required []string `json:"required,omitempty"`
AdditionalProperties any `json:"additionalProperties,omitempty"`
// contains filtered or unexported fields
}
func (JSONSchema) CompileInputSchema ¶
func (s JSONSchema) CompileInputSchema() error
CompileInputSchema verifies that the complete, original schema can be loaded and resolved by the standards-compliant Draft 7 / Draft 2020-12 validator.
func (JSONSchema) MarshalJSON ¶
func (s JSONSchema) MarshalJSON() ([]byte, error)
func (*JSONSchema) UnmarshalJSON ¶
func (s *JSONSchema) UnmarshalJSON(data []byte) error
func (JSONSchema) ValidateInput ¶
func (s JSONSchema) ValidateInput(instance any) error
ValidateInput validates a JSON value against the complete original schema. Business and authorization rules remain exclusively server-authoritative.
type Manifest ¶
type Manifest struct {
ManifestVersion int `json:"manifest_version"`
SnapshotVersion int `json:"snapshot_version"`
SnapshotDigest string `json:"snapshot_sha256"`
Endpoint string `json:"endpoint"`
Tools []ToolMapping `json:"tools"`
Resources []ResourceMapping `json:"resources"`
}
func BuildManifest ¶
func ParseManifest ¶
type Property ¶
type Property struct {
Type any `json:"type,omitempty"`
Description string `json:"description,omitempty"`
Format string `json:"format,omitempty"`
Enum []any `json:"enum,omitempty"`
Items json.RawMessage `json:"items,omitempty"`
Default any `json:"default,omitempty"`
OneOf []any `json:"oneOf,omitempty"`
AnyOf []any `json:"anyOf,omitempty"`
// contains filtered or unexported fields
}
func (Property) ItemProperty ¶
ItemProperty returns the item schema used by a homogeneous array property. Boolean and tuple item schemas deliberately return false: they remain fully supported by JSON validation, but do not have an unambiguous scalar CLI flag.
func (Property) MarshalJSON ¶
func (Property) PrimaryType ¶
func (*Property) UnmarshalJSON ¶
type ResourceMapping ¶
type Snapshot ¶
type Snapshot struct {
SnapshotVersion int `json:"snapshot_version"`
GeneratedAt string `json:"generated_at"`
Source string `json:"source"`
Endpoint string `json:"endpoint"`
Tools []Tool `json:"tools"`
Resources []Resource `json:"resources"`
}
func ParseSnapshot ¶
type Tool ¶
type Tool struct {
Name string `json:"name"`
Description string `json:"description"`
InputSchema JSONSchema `json:"inputSchema"`
Annotations Annotations `json:"annotations"`
}
type ToolMapping ¶
type ToolMapping struct {
Tool string `json:"tool"`
Domain string `json:"domain"`
Command string `json:"command"`
ReadOnly bool `json:"read_only"`
}
func (ToolMapping) Path ¶
func (m ToolMapping) Path() string
type ValidationError ¶
type ValidationError struct {
Path string `json:"path"`
Constraint string `json:"constraint"`
Expected string `json:"expected,omitempty"`
Properties []string `json:"properties,omitempty"`
}
ValidationError is a value-free, user-facing description of a JSON Schema failure. It intentionally never includes the rejected instance value.
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string