Fix #[schemars(with = ...)] alongside #[serde(transparent)] (#67)
Co-authored-by: Graham Esau <gesau@hotmail.co.uk>
This commit is contained in:
parent
1c9ecafd32
commit
c4ef7bad22
4 changed files with 43 additions and 26 deletions
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"title": "schema_fn",
|
||||
"type": "boolean"
|
||||
}
|
|
@ -42,3 +42,12 @@ pub struct Newtype(#[schemars(schema_with = "schema_fn")] DoesntImplementJsonSch
|
|||
fn struct_newtype() -> TestResult {
|
||||
test_default_generated_schema::<Newtype>("schema_with-newtype")
|
||||
}
|
||||
|
||||
#[derive(Debug, JsonSchema)]
|
||||
#[schemars(transparent)]
|
||||
pub struct TransparentNewtype(#[schemars(schema_with = "schema_fn")] DoesntImplementJsonSchema);
|
||||
|
||||
#[test]
|
||||
fn struct_transparent_newtype() -> TestResult {
|
||||
test_default_generated_schema::<TransparentNewtype>("schema_with-transparent-newtype")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue