Creates a string enumeration schema.
Pass an array of entries, or a record mapping each entry to a description
of what it means. The JSON Schema stays provider-safe: it emits a plain
enum, and the entry descriptions are appended to the description as a
- key: description list.
API
export declare function enumeration<const Entries extends readonly string[]>(
description: string,
entries: [...Entries],
): EnumType <Entries>;API
export declare function enumeration<const Entry extends string>(
description: string,
entries: Record <Entry, string>,
): EnumType <Entry[]>;Examples
const kind = s.enumeration('Kind', { jet: 'Jets', rotor: 'Helicopters' });