Skip to content

SchemaSource

Defines a source of schemas

export type SchemaSource = {
name: string;
source: DataSource;
};

Attributes

name: string

The name of the schema source is emitted along with any errors that occur while setting up the validator so that schema authors and consumers can easily pinpoint issues.

source: DataSource

The data source definition.

Usage

If your schemas are going to be consumed in different packages you are encourage to export a constant from the package where the schemas reside so that consumers can easily configure loaders an processors.

Designer Decisions built-in schemas in @noodlestan/designer-schemas are exposed this way.

const DECISION_SCHEMAS: SchemaSource = {
urnBase: 'urn:designer',
source: {
type: 'package',
package: '@noodlestan/designer-schemas',
path: 'schemas/',
},
};

Both the minimal boilerplate and the Astro boilerplate import this constant to build and validate options for the staticStoreBuilder() function.

See also