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
I am writting an API with Axum and I am using and enum to recevibe o single value or a list of values. For that I am using a Enum with a generic type T
pubenumOneOrMany<T>{/// A single valueOne(T),/// A list of valuesMany(Vec<T>),}
To generate the OpenAPi I use aliases aliases(StringOneOrMany = OneOrMany<String>) and when I generate the openapi.json it serialize as
"StringOneOrMany": {
"oneOf": [
{
"$ref": "#/components/schemas/T"
},
{
"type": "array",
"items": {
"$ref": "#/components/schemas/T"
},
"description": "A list of values"
}
]
},
How can I generate the schema correctly without using value_type=
pubenumOneOrMany<T>{#[schema(value_type = String)]/// A single valueOne(T),#[schema(value_type = Vec<String>)]/// A list of valuesMany(Vec<T>),}
With schemars the is no problem.
The text was updated successfully, but these errors were encountered:
I am writting an API with Axum and I am using and enum to recevibe o single value or a list of values. For that I am using a Enum with a generic type
T
To generate the OpenAPi I use aliases
aliases(StringOneOrMany = OneOrMany<String>)
and when I generate the openapi.json it serialize asHow can I generate the schema correctly without using
value_type=
With
schemars
the is no problem.The text was updated successfully, but these errors were encountered: