Open Chaoses-Ib opened 1 month ago
Oh, I just found it's not officially supported by JSON Schema: https://github.com/json-schema-org/json-schema-vocabularies/issues/47. Though there is a workaround:
{
"docHint": "enum",
"anyOf": [
{ "const": "a", "description": "A" },
{ "const": "b", "description": "B" },
{ "const": "c", "description": "C" }
]
}
I'll have to come back to this, but note that Glaze does not automatically reflect your enum. Meaning it will treat your enum values as integers by default.
Use a glz::meta for your enum and the enumerate
function to list out your enum values (which can be reflected there). I expect this might then work with your json schema description in Glaze.
Is it possible to specify description for enum values? I tried the following code but it doesn't work: