You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are two scenarios with enums in specs which are not supported (both elaborated on in this thread):
Enums with item descriptions
According to one of the JSON Schema maintainers, the standard pattern for this is by wrapping each case in a singleton type with a description, ie like:
myEnum:
type: int
oneOf:
- enum: [1]
title: Foo
- enum: [2]
title: Bar
description: This is a bar
to translate to
enum MyEnum
{
Foo = 1,
/// <summary>This is a bar</summary>
Bar = 2
}
Open-ended/extensible enums
The pattern for this as described on the thread is allegedly:
I don't have a strong view on the choice of C# representation but note that the string + static class route has more flexibility to handle non-string enums too, if that's of interest. (Personally, I currently require only strings.)
There are two scenarios with enums in specs which are not supported (both elaborated on in this thread):
Enums with item descriptions
According to one of the JSON Schema maintainers, the standard pattern for this is by wrapping each case in a singleton type with a description, ie like:
to translate to
Open-ended/extensible enums
The pattern for this as described on the thread is allegedly:
to translate, I guess, to
or perhaps just as a vanilla
string
together with the generation of a class likeI propose that both of these patterns, and their combination (as I described on the referenced thread), are detected and supported.
The text was updated successfully, but these errors were encountered: