mirror of
https://gitlab.com/msrd0/gotham-restful.git
synced 2025-05-09 08:00:41 +00:00
more enum stuff
[skip ci]
This commit is contained in:
parent
43d3a1cd89
commit
5f60599c41
2 changed files with 85 additions and 2 deletions
|
@ -77,3 +77,68 @@ test_type!(EnumWithOneField = {
|
|||
},
|
||||
"required": ["Success"]
|
||||
});
|
||||
|
||||
#[derive(OpenapiType)]
|
||||
enum EnumWithFields {
|
||||
Success { value: isize },
|
||||
Error { msg: String }
|
||||
}
|
||||
test_type!(EnumWithFields = {
|
||||
"title": "EnumWithFields",
|
||||
"oneOf": [{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"Success": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"value": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"required": ["value"]
|
||||
}
|
||||
},
|
||||
"required": ["Success"]
|
||||
}, {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"Error": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"msg": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": ["msg"]
|
||||
}
|
||||
},
|
||||
"required": ["Error"]
|
||||
}]
|
||||
});
|
||||
|
||||
#[derive(OpenapiType)]
|
||||
enum EnumExternallyTagged {
|
||||
Success { value: isize },
|
||||
Error
|
||||
}
|
||||
test_type!(EnumExternallyTagged = {
|
||||
"title": "EnumExternallyTagged",
|
||||
"oneOf": [{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"Success": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"value": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"required": ["value"]
|
||||
}
|
||||
},
|
||||
"required": ["Success"]
|
||||
}, {
|
||||
"type": "string",
|
||||
"enum": ["Error"]
|
||||
}]
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue