Documentation
¶
Index ¶
- Constants
- Variables
- func DetailSchemaSHA256(schema map[string]any) (string, error)
- func GenerateTypeScript(contract Contract) ([]byte, error)
- func SchemaSHA256(schema map[string]any) (string, error)
- func Validate(contract Contract) error
- func ValidatePin(pin Pin) error
- func ValidateValue(schema map[string]any, value any) error
- type BusinessError
- type CancelPolicy
- type Confirmation
- type Contract
- type KnownContract
- type Method
- type Pin
- type Quota
- type Registry
Constants ¶
View Source
const ( MaxSchemaDepth = 32 MaxSchemaNodes = 4096 MaxSchemaProperties = 1024 MaxSchemaEnumValues = 1024 MaxSchemaBranches = 64 )
View Source
const SchemaVersion = "redevplugin.host_capability_contract.v1"
Variables ¶
View Source
var ( ErrInvalidContract = errors.New("host capability contract is invalid") ErrIdentityMismatch = errors.New("host capability contract identity mismatch") )
Functions ¶
func GenerateTypeScript ¶
func ValidatePin ¶
Types ¶
type BusinessError ¶
type CancelPolicy ¶
type Confirmation ¶
type Contract ¶
type Contract struct {
SchemaVersion string `json:"schema_version"`
ContractID string `json:"contract_id"`
ContractVersion string `json:"contract_version"`
PublisherID string `json:"publisher_id"`
CapabilityID string `json:"capability_id"`
CapabilityVersion string `json:"capability_version"`
ClientName string `json:"client_name"`
Methods []Method `json:"methods"`
Errors []BusinessError `json:"errors,omitempty"`
}
type KnownContract ¶ added in v1.0.0
func NewKnownContract ¶ added in v1.0.0
func NewKnownContract(contract Contract) (KnownContract, error)
NewKnownContract validates a Host-owned contract and binds its local registry identity to the canonical contract bytes shipped with the Host.
func NewKnownContractFromArtifact ¶ added in v1.1.3
func NewKnownContractFromArtifact(raw []byte) (KnownContract, error)
NewKnownContractFromArtifact validates a published contract artifact while retaining the digest of its exact immutable bytes as the registry pin.
type Method ¶
type Method struct {
Name string `json:"name"`
ClientMethod string `json:"client_method"`
Effect string `json:"effect"`
Execution string `json:"execution"`
PreflightOnly bool `json:"preflight_only,omitempty"`
RequiredPermissions []string `json:"required_permissions,omitempty"`
TargetFields []string `json:"target_fields"`
TargetSchema map[string]any `json:"target_schema"`
RequestTypeName string `json:"request_type_name"`
ResponseTypeName string `json:"response_type_name"`
RequestSchema map[string]any `json:"request_schema"`
ResponseSchema map[string]any `json:"response_schema"`
EventTypeName string `json:"event_type_name,omitempty"`
EventSchema map[string]any `json:"event_schema,omitempty"`
Confirmation *Confirmation `json:"confirmation,omitempty"`
CancelPolicy *CancelPolicy `json:"cancel_policy,omitempty"`
Quota Quota `json:"quota"`
}
Click to show internal directories.
Click to hide internal directories.