Corvus.JsonSchema
Corvus.JsonSchema copied to clipboard
Enhance enumeration support
The enum keyword itself doesn't support documentation.
The recommended method for "documenting" your enum-like values is to use the oneOf keyword:
"oneOf": [
{ "const": "some value", "title": "Some value", "description": "The documentation for some value" },
{ "const": "some other value", "title": "Some other value", "description": "The documentation for some other value" },
]
We do not want to change our implementation of the enum keyword itself as it would be a significant breaking change.
However, we could detect this pattern and emit different code.
For instance
- We could conventionally use
titleas the name of the enum value if present - We could conventionally use
descriptionas the summary documentation for the enum value - We could detect "pure integer" enumerations and emit a dotnet
enuminstead of the static values.