Corvus.JsonSchema icon indicating copy to clipboard operation
Corvus.JsonSchema copied to clipboard

Enhance enumeration support

Open mwadams opened this issue 1 year ago • 0 comments

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

  1. We could conventionally use title as the name of the enum value if present
  2. We could conventionally use description as the summary documentation for the enum value
  3. We could detect "pure integer" enumerations and emit a dotnet enum instead of the static values.

mwadams avatar Mar 13 '24 09:03 mwadams