Enable deriving JsonSchema for unit/newtype/tuple structs

This commit is contained in:
Graham Esau 2019-09-07 16:36:12 +01:00
parent 07f4f68a02
commit 3f5f7cf0a3
6 changed files with 107 additions and 18 deletions

View file

@ -0,0 +1,5 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Newtype",
"type": "integer"
}

View file

@ -0,0 +1,17 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Struct",
"type": "object",
"properties": {
"bar": {
"type": "boolean"
},
"foo": {
"type": "integer"
}
},
"required": [
"bar",
"foo"
]
}

View file

@ -0,0 +1,15 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Tuple",
"type": "array",
"items": [
{
"type": "integer"
},
{
"type": "boolean"
}
],
"maxItems": 2,
"minItems": 2
}

View file

@ -0,0 +1,5 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Unit",
"type": "null"
}