shareable

package
v0.2.17 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 18, 2026 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Canonicalizer

type Canonicalizer interface {
	Canonicalize(
		ctx context.Context,
		raw []byte,
	) (ParsedDocument, error)
}

Canonicalizer is the narrow validation capability needed by artifact-family hydration and linked-source descriptor readers.

type Codec

type Codec interface {
	Key() SchemaKey
	JSONSchema() []byte

	// Canonicalize strictly decodes, validates, calculates or verifies the
	// optional supplied digest, and returns canonical JSON containing the
	// calculated digest. It does not persist source content.
	Canonicalize(
		ctx context.Context,
		raw []byte,
	) (ParsedDocument, error)
}

type EntityCanonicalizer added in v0.2.17

type EntityCanonicalizer interface {
	CanonicalizeEntity(
		ctx context.Context,
		entity EntityType,
		raw []byte,
	) (ParsedDocument, error)
}

EntityCanonicalizer supports both shareable Collection and Artifact documents without implying local entity creation or persistence.

type EntityType

type EntityType string
const (
	EntityCollection EntityType = "collection"
	EntityArtifact   EntityType = "artifact"
)

type ExpectedCanonicalizer added in v0.2.17

type ExpectedCanonicalizer interface {
	CanonicalizeExpected(
		ctx context.Context,
		expected SchemaKey,
		raw []byte,
	) (ParsedDocument, error)
}

ExpectedCanonicalizer is the narrow Artifact Store boundary for consumers that accept one known shareable schema. It ensures that callers do not bypass registry dispatch and validate an arbitrary schema before checking its expected identity.

type ParsedDocument

type ParsedDocument struct {
	Key    SchemaKey
	Digest cryptoutil.Digest
	Raw    json.RawMessage
}

func (ParsedDocument) Clone

func (d ParsedDocument) Clone() ParsedDocument

func (ParsedDocument) Validate

func (d ParsedDocument) Validate() error

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

func NewRegistry

func NewRegistry(codecs ...Codec) (*Registry, error)

func (*Registry) Canonicalize

func (r *Registry) Canonicalize(
	ctx context.Context,
	raw []byte,
) (ParsedDocument, error)

func (*Registry) CanonicalizeEntity added in v0.2.17

func (r *Registry) CanonicalizeEntity(
	ctx context.Context,
	entity EntityType,
	raw []byte,
) (ParsedDocument, error)

func (*Registry) CanonicalizeExpected added in v0.2.17

func (r *Registry) CanonicalizeExpected(
	ctx context.Context,
	expected SchemaKey,
	raw []byte,
) (ParsedDocument, error)

CanonicalizeExpected canonicalizes raw content through the Artifact Store registry and requires the resulting schema key to match expected.

Feature services use this boundary for known document inputs. The registry remains the only owner of JSON Schema execution, codec selection, canonical JSON enforcement, and canonical output validation.

func (*Registry) Keys

func (r *Registry) Keys() []SchemaKey

type SchemaKey

type SchemaKey struct {
	Entity        EntityType        `json:"entity"`
	Kind          SchemaKind        `json:"kind"`
	SchemaID      basespec.SchemaID `json:"schemaID"`
	SchemaVersion string            `json:"schemaVersion"`
}

func ArtifactSchemaKey added in v0.2.17

func ArtifactSchemaKey(
	kind basespec.ArtifactKind,
	schemaID basespec.SchemaID,
	schemaVersion string,
) SchemaKey

func CollectionSchemaKey added in v0.2.17

func CollectionSchemaKey(
	kind basespec.CollectionKind,
	schemaID basespec.SchemaID,
	schemaVersion string,
) SchemaKey

func (SchemaKey) Validate

func (k SchemaKey) Validate() error

type SchemaKind added in v0.2.17

type SchemaKind string

SchemaKind is the entity-neutral kind portion of a shareable schema key.

It intentionally is not a CollectionKind. Artifact schema keys must not require a misleading ArtifactKind-to-CollectionKind conversion merely to participate in one schema registry.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL