oneOf -> anyOf for maybe types

master
Paul Loyd 2018-01-13 20:54:46 +03:00
parent 09f37c29bc
commit 414a3f5186
3 changed files with 7 additions and 7 deletions

View File

@ -140,7 +140,7 @@ function convert(fund: Fund, type: ?Type): Schema {
};
case 'maybe':
return {
oneOf: [convert(fund, type.value), {type: 'null'}],
anyOf: [convert(fund, type.value), {type: 'null'}],
};
case 'number':
const {repr} = type;

View File

@ -4,8 +4,8 @@
"maybe::X": {
"type": "object",
"properties": {
"x": {"oneOf": [{"type": "string"}, {"type": "null"}]},
"xx": {"oneOf": [{"type": "string"}, {"type": "null"}]}
"x": {"anyOf": [{"type": "string"}, {"type": "null"}]},
"xx": {"anyOf": [{"type": "string"}, {"type": "null"}]}
},
"required": ["x", "xx"]
},
@ -13,12 +13,12 @@
"type": "object",
"properties": {
"y": {
"oneOf": [
"anyOf": [
{"type": "array", "items": {"type": "string"}},
{"type": "null"}
]
},
"yy": {"oneOf": [{"type": "string"}, {"type": "null"}]}
"yy": {"anyOf": [{"type": "string"}, {"type": "null"}]}
},
"required": ["y", "yy"]
},
@ -27,7 +27,7 @@
"properties": {
"z": {
"type": "array",
"items": {"oneOf": [{"type": "string"}, {"type": "null"}]}
"items": {"anyOf": [{"type": "string"}, {"type": "null"}]}
}
},
"required": ["z"]

View File

@ -1,7 +1,7 @@
{
"$schema": "http://json-schema.org/draft-06/schema#",
"definitions": {
"nonMaybeType::X": {"oneOf": [{"type": "string"}, {"type": "null"}]},
"nonMaybeType::X": {"anyOf": [{"type": "string"}, {"type": "null"}]},
"nonMaybeType::Y": {"type": "string"}
}
}