Reduce memory footprint of SchemaObject.

Nested validation structs are now wrapped in Option<Box<_>>, reducing size of JsonSchema (depending on system) from 688 to 424 bytes.
This commit is contained in:
Graham Esau 2019-10-13 20:42:29 +01:00
parent 5a82498e28
commit 72629a3c37
12 changed files with 87 additions and 38 deletions

View file

@ -4,7 +4,16 @@
"type": "object",
"definitions": {
"another-new-name": {
"type": "object"
"type": "object",
"required": [
"foo"
],
"properties": {
"foo": {
"type": "integer",
"format": "int32"
}
}
}
},
"required": [

View file

@ -4,7 +4,16 @@
"type": "object",
"definitions": {
"MySimpleStruct": {
"type": "object"
"type": "object",
"required": [
"foo"
],
"properties": {
"foo": {
"type": "integer",
"format": "int32"
}
}
}
},
"required": [

View file

@ -12,7 +12,9 @@ struct MyStruct<T, U, V, W> {
}
#[derive(Debug, JsonSchema)]
struct MySimpleStruct {}
struct MySimpleStruct {
foo: i32,
}
#[test]
fn default_name_multiple_type_params() -> TestResult {
@ -33,7 +35,9 @@ struct MyRenamedStruct<T, U, V, W> {
#[derive(Debug, JsonSchema)]
#[serde(rename = "this-attribute-is-ignored")]
#[schemars(rename = "another-new-name")]
struct MySimpleRenamedStruct {}
struct MySimpleRenamedStruct {
foo: i32,
}
#[test]
fn overriden_with_rename_multiple_type_params() -> TestResult {