Skip to content

DataSource

The DataSource data structure defines how to load schemas and decisions.

export type DataSourcePackage = { type: 'package'; package: string; path: string };
export type DataSourcePath = { type: 'path'; path: string };
export type DataSource = DataSourcePackage | DataSourcePath;

Data Source Types

Currently, only file system based data source types are supported, but our plans include the ability to fetch data from remote locations as well.

DataSourcePath

Defines a relative or absolute path in the filesystem.

Example:

const data: DataSource = { type: 'path', path: './data' };

The minimal boilerplate uses this format to declare the local data.

type: "path"

path: string

Either relative to the current working directory or absolute in the filesystem.

DataSourcePackage

Defines a path relative to the root of a specific package.

Example:

const data = { type: 'package', package: '@noodlestan/designer-schemas', path: './schemas' };

Both the demo data in @noodlestan/designer-decisions and the schemas in @noodlestan/designer-decisions are exposed this way.

type: “package”

name: string

The name of the package as declared in its package.json.

path: string

The path within the package.

See also