Revert "Support generic default values"
This feature inadvertently introduced a breaking change (#144) This reverts commits:feb6c4b2fe
b38a55331b
.
This commit is contained in:
parent
1610294af4
commit
d93bdc43e3
3 changed files with 1 additions and 27 deletions
|
@ -56,15 +56,3 @@ struct NotSerialize;
|
|||
fn schema_default_values() -> TestResult {
|
||||
test_default_generated_schema::<MyStruct>("default")
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(JsonSchema)]
|
||||
struct StructWithGenericDefaults {
|
||||
#[serde(default = "Vec::new")]
|
||||
a_vec: Vec<String>,
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn schema_with_generic_default_value() -> TestResult {
|
||||
test_default_generated_schema::<StructWithGenericDefaults>("generic_default")
|
||||
}
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"title": "StructWithGenericDefaults",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"a_vec": {
|
||||
"default": [],
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -581,7 +581,7 @@ fn field_default_expr(field: &Field, container_has_default: bool) -> Option<Toke
|
|||
quote!(container_default.#member)
|
||||
}
|
||||
SerdeDefault::Default => quote!(<#ty>::default()),
|
||||
SerdeDefault::Path(path) => quote!({ #path() as #ty }),
|
||||
SerdeDefault::Path(path) => quote!(#path()),
|
||||
};
|
||||
|
||||
let default_expr = match field.serde_attrs.skip_serializing_if() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue