createFlagSchema
Generated reference page for the createFlagSchema function export.
- Import:
@kjanat/dreamcli - Export kind: function
- Declared in:
src/core/schema/flag.ts - Source link:
src/core/schema/flag.ts:1027
Signatures
Overload 1
ts
function createFlagSchema<K extends "string" | "number" | "boolean" | "enum" | "array" | "custom" | "count" | "keyValue">(kind: K, overrides?: FlagDefinitionOverrides<K>): FlagSchema<K>;| Parameter | Type | Description |
|---|---|---|
kind | K | Discriminator for the value type this flag accepts. |
overrides | FlagDefinitionOverrides<K> | undefined | Definition fields for kind, shallow-merged onto defaults. |
Overload 2
ts
function createFlagSchema<K extends "string" | "number" | "boolean" | "enum" | "array" | "custom" | "count" | "keyValue">(definition: FlagSchema<K> | FlagDefinition<K>): FlagSchema<K>;| Parameter | Type | Description |
|---|---|---|
definition | FlagSchema<K> | FlagDefinition<K> | Kind discriminator plus the fields valid for that kind. |
Members
Members
createFlagSchema
Create a raw FlagSchema object with sensible defaults.
Most consumers should prefer the higher-level flag factory, which returns an immutable FlagBuilder with type inference and safe modifier chaining. createFlagSchema() is the low-level escape hatch for advanced schema composition, tests, or custom factories that need the plain runtime descriptor.
Fields are shallow-merged on top of the default shape, so callers are responsible for keeping the resulting schema internally consistent.
ts
(kind: K, overrides?: FlagDefinitionOverrides<K>): FlagSchema<K>;createFlagSchema
Create a raw FlagSchema object from a single definition object.
An already-built FlagSchema is accepted and re-normalized into a deep-equal schema.
ts
(definition: FlagSchema<K> | FlagDefinition<K>): FlagSchema<K>;Examples
ts
const schema = createFlagSchema('enum', {
enumValues: ['us', 'eu', 'ap'],
description: 'Deployment region',
});ts
const schema = createFlagSchema({
kind: 'array',
elementSchema: { kind: 'string' },
separator: ',',
});