Versions in this module Expand all Collapse all v0 v0.1.0 Aug 28, 2026 Changes in this version + var ErrEmpty = errors.NewSentinel("schema.empty", "schema: a schema must carry bytes") + var ErrImmutable = errors.NewSentinel("schema.immutable", ...) + var ErrInvalidLanguage = errors.NewSentinel("schema.invalid_language", "schema: not a schema language this module defines") + var ErrInvalidPayload = errors.NewSentinel("schema.invalid_payload", "schema: payload does not conform to its schema") + var ErrNotFound = errors.NewSentinel("schema.not_found", "schema: no schema is published under that identifier") + var ErrSchemaUnusable = errors.NewSentinel("schema.unusable", ...) + var ErrUnknownLanguage = errors.NewSentinel("schema.unknown_language", ...) + var ErrUnsupportedCompatibility = errors.NewSentinel("schema.unsupported_compatibility", ...) + type Checker interface + Check func(ctx context.Context, prior, next Schema, mode Compatibility) error + Language func() Language + type Compatibility string + const CompatibilityBackward + const CompatibilityForward + const CompatibilityFull + const CompatibilityNone + type Guard struct + func NewGuard(resolver Resolver, validators []Validator, opts ...GuardOption) *Guard + func (g *Guard) Unvalidated() uint64 + func (g *Guard) Validate(ctx context.Context, dataschema string, payload []byte) error + type GuardOption func(*Guard) + func OnFailOpen(f func(ctx context.Context, dataschema string, cause error)) GuardOption + type Language string + const JSONSchema + const Protobuf + func (l Language) Valid() bool + type MemoryStore struct + func NewMemoryStore() *MemoryStore + func (m *MemoryStore) Get(_ context.Context, id urn.Schema) (Schema, error) + func (m *MemoryStore) List(_ context.Context) ([]urn.Schema, error) + func (m *MemoryStore) Put(_ context.Context, s Schema) error + func (m *MemoryStore) Versions(_ context.Context, name string) ([]int, error) + type NoCheck struct + Lang Language + func (n NoCheck) Check(_ context.Context, _, _ Schema, _ Compatibility) error + func (n NoCheck) Language() Language + type Registry struct + func Embed(schemas ...Schema) (*Registry, error) + func New(store Store, checkers ...Checker) *Registry + func (r *Registry) List(ctx context.Context) ([]urn.Schema, error) + func (r *Registry) Publish(ctx context.Context, s Schema, mode Compatibility) error + func (r *Registry) Resolve(ctx context.Context, id urn.Schema) (Schema, error) + func (r *Registry) Versions(ctx context.Context, name string) ([]int, error) + type Resolver interface + Resolve func(ctx context.Context, id urn.Schema) (Schema, error) + type Schema struct + Bytes []byte + Language Language + Root string + URN urn.Schema + type Store interface + Get func(ctx context.Context, id urn.Schema) (Schema, error) + List func(ctx context.Context) ([]urn.Schema, error) + Put func(ctx context.Context, s Schema) error + Versions func(ctx context.Context, name string) ([]int, error) + type Validator interface + Language func() Language + Validate func(ctx context.Context, s Schema, payload []byte) error