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.
- Import:
@kjanat/dreamcli - Export kind: function
- Declared in:
src/core/schema/flag.ts - Source link:
src/core/schema/flag.ts:1415
Signatures
Overload 1
function createFlagSchema<K extends FlagKind>(kind: K, ...overrides: FlagDefinitionArguments<K>): FlagSchema<K>;| Parameter | Type | Description |
|---|---|---|
kind | K | Discriminator for the value type this flag accepts. |
overrides | ...FlagDefinitionArguments<K> | Definition fields for kind, shallow-merged onto defaults. |
Overload 2
function createFlagSchema<K extends FlagKind>(definition: FlagDefinition<K> | FlagSchema<K>): FlagSchema<K>;| Parameter | Type | Description |
|---|---|---|
definition | FlagDefinition<K> | FlagSchema<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.
(kind: K, ...overrides: FlagDefinitionArguments<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.
(definition: FlagDefinition<K> | FlagSchema<K>): FlagSchema<K>;Examples
const schema = createFlagSchema('enum', {
enumValues: ['us', 'eu', 'ap'],
description: 'Deployment region',
});const schema = createFlagSchema({
kind: 'array',
elementSchema: { kind: 'string' },
separator: ',',
});