schemars/schemars/tests/expected/default.json
Graham Esau 63af0ceb73 Fix skip_serializing_if/serialize_with handling
Previously whenever a field with a default value has both `skip_serializing_if` and `with`/`serialize_with` attributes, the value would be converted to a type that performs the custom serialization before checking if it should be serialized. This would cause the wrong type to be given to the skip_serializing_if function, causing a compile error.

Issue #26
2020-04-11 22:06:48 +01:00

43 lines
No EOL
819 B
JSON

{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "MyStruct",
"type": "object",
"properties": {
"my_bool": {
"default": false,
"type": "boolean"
},
"my_int": {
"default": 0,
"type": "integer",
"format": "int32"
},
"my_struct2": {
"default": "i:0 b:false",
"allOf": [
{
"$ref": "#/definitions/MyStruct2"
}
]
},
"my_struct2_default_skipped": {
"$ref": "#/definitions/MyStruct2"
}
},
"definitions": {
"MyStruct2": {
"type": "object",
"properties": {
"my_bool": {
"default": true,
"type": "boolean"
},
"my_int": {
"default": 6,
"type": "integer",
"format": "int32"
}
}
}
}
}