Add test for defaults in derived schemas
Currently ignored as defaults are not yet implemented.
This commit is contained in:
parent
1e9f36122d
commit
81eb53b590
2 changed files with 80 additions and 0 deletions
43
schemars/tests/expected/default.json
Normal file
43
schemars/tests/expected/default.json
Normal file
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"title": "MyStruct",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"my_bool": {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"my_int": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"default": 0
|
||||
},
|
||||
"my_struct2": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/MyStruct2"
|
||||
}
|
||||
],
|
||||
"default": {
|
||||
"my_bool": false,
|
||||
"my_int": 0
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"MyStruct2": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"my_bool": {
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
},
|
||||
"my_int": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"default": 6
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue