oneOf -> anyOf for maybe types
parent
09f37c29bc
commit
414a3f5186
|
@ -140,7 +140,7 @@ function convert(fund: Fund, type: ?Type): Schema {
|
||||||
};
|
};
|
||||||
case 'maybe':
|
case 'maybe':
|
||||||
return {
|
return {
|
||||||
oneOf: [convert(fund, type.value), {type: 'null'}],
|
anyOf: [convert(fund, type.value), {type: 'null'}],
|
||||||
};
|
};
|
||||||
case 'number':
|
case 'number':
|
||||||
const {repr} = type;
|
const {repr} = type;
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
"maybe::X": {
|
"maybe::X": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"x": {"oneOf": [{"type": "string"}, {"type": "null"}]},
|
"x": {"anyOf": [{"type": "string"}, {"type": "null"}]},
|
||||||
"xx": {"oneOf": [{"type": "string"}, {"type": "null"}]}
|
"xx": {"anyOf": [{"type": "string"}, {"type": "null"}]}
|
||||||
},
|
},
|
||||||
"required": ["x", "xx"]
|
"required": ["x", "xx"]
|
||||||
},
|
},
|
||||||
|
@ -13,12 +13,12 @@
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"y": {
|
"y": {
|
||||||
"oneOf": [
|
"anyOf": [
|
||||||
{"type": "array", "items": {"type": "string"}},
|
{"type": "array", "items": {"type": "string"}},
|
||||||
{"type": "null"}
|
{"type": "null"}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"yy": {"oneOf": [{"type": "string"}, {"type": "null"}]}
|
"yy": {"anyOf": [{"type": "string"}, {"type": "null"}]}
|
||||||
},
|
},
|
||||||
"required": ["y", "yy"]
|
"required": ["y", "yy"]
|
||||||
},
|
},
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
"properties": {
|
"properties": {
|
||||||
"z": {
|
"z": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {"oneOf": [{"type": "string"}, {"type": "null"}]}
|
"items": {"anyOf": [{"type": "string"}, {"type": "null"}]}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": ["z"]
|
"required": ["z"]
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"$schema": "http://json-schema.org/draft-06/schema#",
|
"$schema": "http://json-schema.org/draft-06/schema#",
|
||||||
"definitions": {
|
"definitions": {
|
||||||
"nonMaybeType::X": {"oneOf": [{"type": "string"}, {"type": "null"}]},
|
"nonMaybeType::X": {"anyOf": [{"type": "string"}, {"type": "null"}]},
|
||||||
"nonMaybeType::Y": {"type": "string"}
|
"nonMaybeType::Y": {"type": "string"}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue