Documentation
¶
Index ¶
- type Canonicalizer
- type Codec
- type EntityCanonicalizer
- type EntityType
- type ExpectedCanonicalizer
- type ParsedDocument
- type Registry
- func (r *Registry) Canonicalize(ctx context.Context, raw []byte) (ParsedDocument, error)
- func (r *Registry) CanonicalizeEntity(ctx context.Context, entity EntityType, raw []byte) (ParsedDocument, error)
- func (r *Registry) CanonicalizeExpected(ctx context.Context, expected SchemaKey, raw []byte) (ParsedDocument, error)
- func (r *Registry) Keys() []SchemaKey
- type SchemaKey
- type SchemaKind
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 (*Registry) Canonicalize ¶
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.
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 CollectionSchemaKey ¶ added in v0.2.17
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.