The VSCode JSON schema integration supports a custom field enumDescriptions to describe each enum value individually. This is used by various other editors as well. It would be neat if Zod supports this field too, for example:
const kin = z
.enum([
'elf',
'dwarf',
'human'
])
.describe('Your character lineage', [
'Elves are a magical people of otherworldly grace',
'Bold and hardy, dwarves are known as skilled warriors, miners, and workers of stone and metal',
'Humans are the most adaptable and ambitious people among the common kin'
])
console.log(kin.enumDescriptions)
// [
// 'Elves are a magical people of otherworldly grace',
// 'Bold and hardy, dwarves are known as skilled warriors, miners, and workers of stone and metal',
// 'Humans are the most adaptable and ambitious people among the common kin'
// ]
The VSCode JSON schema integration supports a custom field
enumDescriptions
to describe each enum value individually. This is used by various other editors as well. It would be neat if Zod supports this field too, for example: