(schema: EnumSchema)
| 115 | * Get enum display labels from EnumSchema |
| 116 | */ |
| 117 | export function getEnumLabels(schema: EnumSchema): string[] { |
| 118 | if ('oneOf' in schema) { |
| 119 | return schema.oneOf.map(item => item.title) |
| 120 | } |
| 121 | if ('enum' in schema) { |
| 122 | return ('enumNames' in schema ? schema.enumNames : undefined) ?? schema.enum |
| 123 | } |
| 124 | return [] |
| 125 | } |
| 126 | |
| 127 | /** |
| 128 | * Get label for a specific enum value |