Example enum:
#[derive(Deserialize_repr, Serialize_repr)]
#[serde(tag = "tag")]
#[repr(u8)]
enum TaggedEnum {
One = 0,
Two,
Three,
}
This generates the following OpenAPI schema:
{
"oneOf": [
{
"properties": {
"tag": {
"enum": [
0
],
"type": "integer"
}
},
"required": [
"tag"
],
"type": "object"
},
{
"properties": {
"tag": {
"enum": [
1
],
"type": "integer"
}
},
"required": [
"tag"
],
"type": "object"
},
{
"properties": {
"tag": {
"enum": [
2
],
"type": "integer"
}
},
"required": [
"tag"
],
"type": "object"
}
]
}
This implies that serialization results should have the shape of {"tag": 0} etc, but it actually serializes to a plain number.
See the failing tests in #1583
Example enum:
This generates the following OpenAPI schema:
{ "oneOf": [ { "properties": { "tag": { "enum": [ 0 ], "type": "integer" } }, "required": [ "tag" ], "type": "object" }, { "properties": { "tag": { "enum": [ 1 ], "type": "integer" } }, "required": [ "tag" ], "type": "object" }, { "properties": { "tag": { "enum": [ 2 ], "type": "integer" } }, "required": [ "tag" ], "type": "object" } ] }This implies that serialization results should have the shape of
{"tag": 0}etc, but it actually serializes to a plain number.See the failing tests in #1583