Skip to main content

Class: Schema

Defined in: packages/core/src/domain/value-objects/schema.ts:17

A fully-parsed schema loaded from a schema.yaml file.

Schemas are resolved by SchemaRegistry using a three-level lookup: project-local → user override → npm package. Once resolved, the schema is immutable for the lifetime of the operation.

Use artifact(id) for O(1) lookup instead of iterating artifacts().

Constructors

Constructor

new Schema(kind, name, version, artifacts, workflow, metadataExtraction?, extendsRef?): Schema

Defined in: packages/core/src/domain/value-objects/schema.ts:39

Creates a fully-resolved schema instance.

Parameters

kind

SchemaKind

The schema kind (schema or schema-plugin)

name

string

The resolved schema name (e.g. "@specd/schema-std", "my-team-schema")

version

number

The schema version integer, monotonically increasing

artifacts

readonly ArtifactType[]

Artifact type definitions in schema-declared order

workflow

readonly WorkflowStep[]

Workflow step configurations in schema-declared order

metadataExtraction?

MetadataExtraction

Optional metadata extraction declarations

extendsRef?

string

Optional parent schema reference

Returns

Schema

Methods

artifact()

artifact(id): ArtifactType | null

Defined in: packages/core/src/domain/value-objects/schema.ts:92

Returns the artifact type with the given id, or null if not found.

Parameters

id

string

The artifact type ID (e.g. "specs", "tasks")

Returns

ArtifactType | null

The matching artifact type, or null


artifacts()

artifacts(): readonly ArtifactType[]

Defined in: packages/core/src/domain/value-objects/schema.ts:82

All artifact type definitions in schema-declared order.

Returns

readonly ArtifactType[]

All artifact types in declaration order


extendsRef()

extendsRef(): string | undefined

Defined in: packages/core/src/domain/value-objects/schema.ts:140

The parent schema reference from extends, or undefined if this schema does not extend another.

Returns

string | undefined

The parent schema reference, or undefined


kind()

kind(): SchemaKind

Defined in: packages/core/src/domain/value-objects/schema.ts:130

The schema kind discriminator (schema or schema-plugin).

Returns

SchemaKind

The schema kind


metadataExtraction()

metadataExtraction(): MetadataExtraction | undefined

Defined in: packages/core/src/domain/value-objects/schema.ts:102

The metadata extraction declarations, or undefined if the schema does not declare metadataExtraction.

Returns

MetadataExtraction | undefined

The metadata extraction configuration, or undefined


name()

name(): string

Defined in: packages/core/src/domain/value-objects/schema.ts:64

The resolved schema name (e.g. "@specd/schema-std", "my-team-schema").

Returns

string

The schema name


version()

version(): number

Defined in: packages/core/src/domain/value-objects/schema.ts:73

The schema version integer from schema.yaml. Monotonically increasing.

Returns

number

The schema version


workflow()

workflow(): readonly WorkflowStep[]

Defined in: packages/core/src/domain/value-objects/schema.ts:111

All workflow step configurations in schema-declared order.

Returns

readonly WorkflowStep[]

All workflow steps in declaration order


workflowStep()

workflowStep(step): WorkflowStep | null

Defined in: packages/core/src/domain/value-objects/schema.ts:121

Returns the workflow step for the given step name, or null if not found.

Parameters

step

string

The step name (e.g. "implementing", "archiving")

Returns

WorkflowStep | null

The matching workflow step, or null