Handle required flattened Option fields
This commit is contained in:
parent
b68132f17d
commit
1a2dafc1a5
5 changed files with 37 additions and 18 deletions
|
@ -14,7 +14,8 @@
|
|||
"regex_str1",
|
||||
"regex_str2",
|
||||
"required_option",
|
||||
"tel"
|
||||
"tel",
|
||||
"x"
|
||||
],
|
||||
"properties": {
|
||||
"min_max": {
|
||||
|
@ -76,6 +77,10 @@
|
|||
},
|
||||
"required_option": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"x": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -32,6 +32,14 @@ pub struct Struct {
|
|||
map_contains: HashMap<String, ()>,
|
||||
#[validate(required)]
|
||||
required_option: Option<bool>,
|
||||
#[validate(required)]
|
||||
#[serde(flatten)]
|
||||
required_flattened: Option<Inner>,
|
||||
}
|
||||
|
||||
#[derive(Debug, JsonSchema)]
|
||||
pub struct Inner {
|
||||
x: i32,
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue