Process validation attributes in newtype structs
This commit is contained in:
parent
60a9869448
commit
31a5893d10
3 changed files with 18 additions and 2 deletions
8
schemars/tests/expected/validate_newtype.json
Normal file
8
schemars/tests/expected/validate_newtype.json
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"title": "NewType",
|
||||
"type": "integer",
|
||||
"format": "uint8",
|
||||
"maximum": 10.0,
|
||||
"minimum": 0.0
|
||||
}
|
|
@ -46,3 +46,11 @@ pub struct Inner {
|
|||
fn validate() -> TestResult {
|
||||
test_default_generated_schema::<Struct>("validate")
|
||||
}
|
||||
|
||||
#[derive(Debug, JsonSchema)]
|
||||
pub struct NewType(#[validate(range(max = 10))] u8);
|
||||
|
||||
#[test]
|
||||
fn validate_newtype() -> TestResult {
|
||||
test_default_generated_schema::<NewType>("validate_newtype")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue