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

Type Aliases

Variables

Functions

formatType

TypeScript
function formatType(typeSpec): string;

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

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.

isSupportedSchemaUri

TypeScript
function isSupportedSchemaUri(schemaUri): boolean;

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

Whether a $schema URI matches one of the supported schema versions (after trailing-slash normalisation).

Parameters

Parameter Type
schemaUri string

Returns

boolean

normaliseFieldDescriptor

TypeScript
function normaliseFieldDescriptor(raw): FieldDescriptor;

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

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:300

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:349

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

normaliseSchemaUri

TypeScript
function normaliseSchemaUri(uri): string;

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

Normalise a $schema URI for comparison: strip a single trailing slash.

Parameters

Parameter Type
uri string

Returns

string

normaliseShortcodeSchema

TypeScript
function normaliseShortcodeSchema(raw): ShortcodeSchema;

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

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

resolveSchemaVersion

TypeScript
function resolveSchemaVersion(schemaUri): SchemaVersion;

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

Resolve a schema version from an instance file’s $schema URI. Returns "v1" when no URI is present or the URI is unrecognised.

Parameters

Parameter Type
schemaUri string | undefined

Returns

SchemaVersion

typeIncludes

TypeScript
function typeIncludes(typeSpec, name): boolean;

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

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:127

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:129

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:136

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:138
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:148
classes? Record<string, ClassDefinition> CSS classes contributed by the extension. packages/schema/src/types/schema.ts:150
formats? Record<string, RecordFieldDescriptor>> Format-specific options the extension supports. packages/schema/src/types/schema.ts:144
options? Record<string, FieldDescriptor> Options (top-level YAML keys) the extension accepts. packages/schema/src/types/schema.ts:140
projects? string[] Project types contributed by the extension (suggested for project.type). packages/schema/src/types/schema.ts:146
shortcodes? Record<string, ShortcodeSchema> Shortcodes the extension provides. packages/schema/src/types/schema.ts:142

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
additionalProperties? boolean | FieldDescriptor Whether/how additional object keys are allowed (for type: object). packages/schema/src/types/schema.ts:101
aliases? string[] Alternative names for the field. packages/schema/src/types/schema.ts:91
completion? CompletionSpec Completion specification for the field. packages/schema/src/types/schema.ts:95
const? unknown Fixed value the field must equal. packages/schema/src/types/schema.ts:89
contentEncoding? string Content encoding for the string value (e.g., base64). packages/schema/src/types/schema.ts:107
contentMediaType? string Media type of the string content (e.g., application/json). packages/schema/src/types/schema.ts:109
default? unknown Default value for the field. packages/schema/src/types/schema.ts:53
dependentRequired? Record<string, string[]> Map of key -> required-when-present keys (for type: object). packages/schema/src/types/schema.ts:105
deprecated? string | boolean | DeprecatedSpec Whether the field is deprecated. Accepts boolean, message string, or structured spec. packages/schema/src/types/schema.ts:93
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:65
enumCaseInsensitive? boolean Whether enum matching is case-insensitive. packages/schema/src/types/schema.ts:67
examples? unknown[] Example values for documentation and tooling. packages/schema/src/types/schema.ts:59
exclusiveMaximum? number Exclusive maximum numeric value (value must be strictly less). packages/schema/src/types/schema.ts:79
exclusiveMinimum? number Exclusive minimum numeric value (value must be strictly greater). packages/schema/src/types/schema.ts:77
format? string JSON Schema format hint (e.g., uri, email, date-time). Annotation only. packages/schema/src/types/schema.ts:61
items? FieldDescriptor Schema for array items when type is “array”. packages/schema/src/types/schema.ts:97
max? number Maximum numeric value. packages/schema/src/types/schema.ts:75
maxItems? number Maximum number of items (for arrays). packages/schema/src/types/schema.ts:87
maxLength? number Maximum string length. packages/schema/src/types/schema.ts:83
min? number Minimum numeric value. packages/schema/src/types/schema.ts:73
minItems? number Minimum number of items (for arrays). packages/schema/src/types/schema.ts:85
minLength? number Minimum string length. packages/schema/src/types/schema.ts:81
multipleOf? number Value must be a multiple of this number. packages/schema/src/types/schema.ts:63
pattern? string Regular expression pattern the value must match. packages/schema/src/types/schema.ts:69
patternExact? boolean Whether the pattern must match the entire value. packages/schema/src/types/schema.ts:71
properties? Record<string, FieldDescriptor> Schema for object properties when type is “object”. packages/schema/src/types/schema.ts:99
propertyNames? string Regular expression that all object keys must match (for type: object). packages/schema/src/types/schema.ts:103
required? boolean Whether the field is required. packages/schema/src/types/schema.ts:51
title? string Short human-readable label. packages/schema/src/types/schema.ts:57
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:156

Raw schema data as parsed from YAML or JSON.

Properties

Property Type Defined in
$schema? string packages/schema/src/types/schema.ts:157
attributes? Record<string, unknown> packages/schema/src/types/schema.ts:162
classes? Record<string, unknown> packages/schema/src/types/schema.ts:163
formats? Record<string, unknown> packages/schema/src/types/schema.ts:160
options? Record<string, unknown> packages/schema/src/types/schema.ts:158
projects? unknown[] packages/schema/src/types/schema.ts:161
shortcodes? Record<string, unknown> packages/schema/src/types/schema.ts:159

ShortcodeSchema

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

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:119
attributes? Record<string, FieldDescriptor> Named attributes accepted by the shortcode. packages/schema/src/types/schema.ts:121
description? string Human-readable description of the shortcode. packages/schema/src/types/schema.ts:117

SchemaVersion

TypeScript
type SchemaVersion = "v1" | "v2";

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

Identifier for which schema version an instance file declares. "v1" corresponds to SCHEMA_V1_VERSION_URI, "v2" to SCHEMA_V2_VERSION_URI.

FIELD_ALIAS_PAIRS

TypeScript
const FIELD_ALIAS_PAIRS: ReadonlyArray<readonly [string, string]>;

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

Pairs of canonical / alias keys for field descriptors. Derived once from KEY_ALIASES, minus replace-with (deprecation-spec scope only). Iterated when checking for camelCase/kebab-case collisions on one descriptor.

SCHEMA_V1_VERSION_URI

TypeScript
const SCHEMA_V1_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:172

Canonical schema version URIs.

v1: original format, kebab-case canonical, dual-keyed. v2: JSON Schema canonical names (camelCase, minimum/maximum, …).

SCHEMA_V2_VERSION_URI

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

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

SCHEMA_VERSION_URI

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

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

Convenience alias for the default schema version URI (SCHEMA_V1_VERSION_URI).

SUPPORTED_SCHEMA_VERSIONS

TypeScript
const SUPPORTED_SCHEMA_VERSIONS: Set<string>;

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

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