Types

Schema Types Module

Extension schema types for parsing _schema.yml, _schema.yaml, and _schema.json files.

Defines types for field descriptors, completion specs, shortcode schemas, and the overall extension schema structure.

Interfaces

Variables

Functions

formatType

TypeScript
function formatType(typeSpec): string;

Defined in: packages/schema/src/types/schema.ts:359

Format a type spec for display (e.g., “number | boolean”).

Parameters

Parameter Type Description
typeSpec string | string[] | undefined Type spec (string, string array, or undefined).

Returns

string

Human-readable type string.

normaliseFieldDescriptor

TypeScript
function normaliseFieldDescriptor(raw): FieldDescriptor;

Defined in: packages/schema/src/types/schema.ts:200

Normalise a raw field descriptor from YAML, converting kebab-case keys to camelCase.

Parameters

Parameter Type Description
raw Record<string, unknown> Raw field descriptor object from YAML

Returns

FieldDescriptor

Normalised FieldDescriptor

normaliseFieldDescriptorMap

TypeScript
function normaliseFieldDescriptorMap(raw): Record<string, FieldDescriptor>;

Defined in: packages/schema/src/types/schema.ts:226

Normalise a map of field descriptors from YAML.

Parameters

Parameter Type Description
raw Record<string, unknown> Raw object mapping field names to descriptors

Returns

Record<string, FieldDescriptor>

Normalised map of FieldDescriptor objects

normaliseSchema

TypeScript
function normaliseSchema(raw): ExtensionSchema;

Defined in: packages/schema/src/types/schema.ts:275

Normalise a raw schema from YAML to an ExtensionSchema.

Parameters

Parameter Type Description
raw RawSchema Raw schema data from YAML parsing

Returns

ExtensionSchema

Normalised ExtensionSchema

normaliseShortcodeSchema

TypeScript
function normaliseShortcodeSchema(raw): ShortcodeSchema;

Defined in: packages/schema/src/types/schema.ts:244

Normalise a raw shortcode schema from YAML.

Parameters

Parameter Type Description
raw Record<string, unknown> Raw shortcode schema object from YAML

Returns

ShortcodeSchema

Normalised ShortcodeSchema

typeIncludes

TypeScript
function typeIncludes(typeSpec, name): boolean;

Defined in: packages/schema/src/types/schema.ts:346

Check whether a type spec includes a given type name.

Parameters

Parameter Type Description
typeSpec string | string[] | undefined Type spec (string, string array, or undefined).
name string Type name to look for.

Returns

boolean

True if the type spec includes the given name.

ClassDefinition

Defined in: packages/schema/src/types/schema.ts:109

Definition for a CSS class contributed by an extension.

Properties

Property Type Description Defined in
description? string Human-readable description of the class. packages/schema/src/types/schema.ts:111

CompletionSpec

Defined in: packages/schema/src/types/schema.ts:15

Completion specification for a field. Describes how a field’s value should be completed in an editor.

Properties

Property Type Description Defined in
dynamic? boolean Whether completion values are dynamically resolved. packages/schema/src/types/schema.ts:25
extensions? string[] File extensions to filter (for file completions). packages/schema/src/types/schema.ts:19
placeholder? string Placeholder text shown in the editor. packages/schema/src/types/schema.ts:21
source? string Source for dynamic completion values. packages/schema/src/types/schema.ts:27
type? string Type of completion (e.g., “file”, “value”). packages/schema/src/types/schema.ts:17
values? string[] Static list of allowed values. packages/schema/src/types/schema.ts:23

DeprecatedSpec

Defined in: packages/schema/src/types/schema.ts:34

Structured deprecation specification for a field. Provides version, message, and optional auto-forwarding to a replacement key.

Properties

Property Type Description Defined in
message? string Human-readable deprecation message. packages/schema/src/types/schema.ts:38
replaceWith? string Replacement key name to auto-forward the value to. packages/schema/src/types/schema.ts:40
since? string Version since which the field is deprecated. packages/schema/src/types/schema.ts:36

ExtensionSchema

Defined in: packages/schema/src/types/schema.ts:118

Complete extension schema parsed from a _schema.yml or _schema.json file. All sections are optional and default to empty objects or arrays.

Properties

Property Type Description Defined in
$schema? string Schema version URI (e.g., “https://m.canouil.dev/quarto-wizard/assets/schema/v1/extension-schema.json”). packages/schema/src/types/schema.ts:120
attributes? Record<string, RecordFieldDescriptor>> Element-level attributes grouped by CSS class or element type (e.g., “_any”, “panel”, “card”). packages/schema/src/types/schema.ts:130
classes? Record<string, ClassDefinition> CSS classes contributed by the extension. packages/schema/src/types/schema.ts:132
formats? Record<string, RecordFieldDescriptor>> Format-specific options the extension supports. packages/schema/src/types/schema.ts:126
options? Record<string, FieldDescriptor> Options (top-level YAML keys) the extension accepts. packages/schema/src/types/schema.ts:122
projects? string[] Project types contributed by the extension (suggested for project.type). packages/schema/src/types/schema.ts:128
shortcodes? Record<string, ShortcodeSchema> Shortcodes the extension provides. packages/schema/src/types/schema.ts:124

FieldDescriptor

Defined in: packages/schema/src/types/schema.ts:47

Descriptor for a single field in an extension schema. Describes the type, constraints, and metadata for a configuration option.

Properties

Property Type Description Defined in
aliases? string[] Alternative names for the field. packages/schema/src/types/schema.ts:83
completion? CompletionSpec Completion specification for the field. packages/schema/src/types/schema.ts:87
const? unknown Fixed value the field must equal. packages/schema/src/types/schema.ts:81
default? unknown Default value for the field. packages/schema/src/types/schema.ts:53
deprecated? string | boolean | DeprecatedSpec Whether the field is deprecated. Accepts boolean, message string, or structured spec. packages/schema/src/types/schema.ts:85
description? string Human-readable description of the field. packages/schema/src/types/schema.ts:55
enum? unknown[] Allowed values for the field. packages/schema/src/types/schema.ts:57
enumCaseInsensitive? boolean Whether enum matching is case-insensitive. packages/schema/src/types/schema.ts:59
exclusiveMaximum? number Exclusive maximum numeric value (value must be strictly less). packages/schema/src/types/schema.ts:71
exclusiveMinimum? number Exclusive minimum numeric value (value must be strictly greater). packages/schema/src/types/schema.ts:69
items? FieldDescriptor Schema for array items when type is “array”. packages/schema/src/types/schema.ts:89
max? number Maximum numeric value. packages/schema/src/types/schema.ts:67
maxItems? number Maximum number of items (for arrays). packages/schema/src/types/schema.ts:79
maxLength? number Maximum string length. packages/schema/src/types/schema.ts:75
min? number Minimum numeric value. packages/schema/src/types/schema.ts:65
minItems? number Minimum number of items (for arrays). packages/schema/src/types/schema.ts:77
minLength? number Minimum string length. packages/schema/src/types/schema.ts:73
pattern? string Regular expression pattern the value must match. packages/schema/src/types/schema.ts:61
patternExact? boolean Whether the pattern must match the entire value. packages/schema/src/types/schema.ts:63
properties? Record<string, FieldDescriptor> Schema for object properties when type is “object”. packages/schema/src/types/schema.ts:91
required? boolean Whether the field is required. packages/schema/src/types/schema.ts:51
type? string | string[] Data type of the field. A single type name or an array of type names for union types. packages/schema/src/types/schema.ts:49

RawSchema

Defined in: packages/schema/src/types/schema.ts:138

Raw schema data as parsed from YAML or JSON.

Properties

Property Type Defined in
$schema? string packages/schema/src/types/schema.ts:139
attributes? Record<string, unknown> packages/schema/src/types/schema.ts:144
classes? Record<string, unknown> packages/schema/src/types/schema.ts:145
formats? Record<string, unknown> packages/schema/src/types/schema.ts:142
options? Record<string, unknown> packages/schema/src/types/schema.ts:140
projects? unknown[] packages/schema/src/types/schema.ts:143
shortcodes? Record<string, unknown> packages/schema/src/types/schema.ts:141

ShortcodeSchema

Defined in: packages/schema/src/types/schema.ts:97

Schema for a shortcode, including its arguments and attributes.

Properties

Property Type Description Defined in
arguments? FieldDescriptor & object[] Positional arguments accepted by the shortcode. packages/schema/src/types/schema.ts:101
attributes? Record<string, FieldDescriptor> Named attributes accepted by the shortcode. packages/schema/src/types/schema.ts:103
description? string Human-readable description of the shortcode. packages/schema/src/types/schema.ts:99

SCHEMA_VERSION_URI

TypeScript
const SCHEMA_VERSION_URI: "https://m.canouil.dev/quarto-wizard/assets/schema/v1/extension-schema.json" = "https://m.canouil.dev/quarto-wizard/assets/schema/v1/extension-schema.json";

Defined in: packages/schema/src/types/schema.ts:151

Canonical schema version URI for the current format.

SUPPORTED_SCHEMA_VERSIONS

TypeScript
const SUPPORTED_SCHEMA_VERSIONS: Set<string>;

Defined in: packages/schema/src/types/schema.ts:157

Set of recognised schema version URIs. Unknown versions produce a warning but are not rejected (forward-compatible).

Back to top

Reuse

MIT