oneOf -> anyOf for maybe types
parent
09f37c29bc
commit
414a3f5186
|
@ -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;
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -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"}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue