-
Notifications
You must be signed in to change notification settings - Fork 27
Closed
Labels
Description
Repro steps
I am using schemas generated from protobufs via protoc-gen-jsonschema.
I am using JSON4 not JSON5.
Use this schema to reproduce the problem show below:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"definitions": {
"foo": {
"properties": {
"number": {
"oneOf": [
{
"type": "integer"
},
{
"type": "null"
}
]
}
},
"additionalProperties": false,
"oneOf": [
{
"type": "null"
},
{
"type": "object"
}
]
}},
"properties": {
"foo": {
"$ref": "#/definitions/foo",
"additionalProperties": false,
"oneOf": [
{
"type": "null"
},
{}
]
}
},
"additionalProperties": false,
"oneOf": [
{
"type": "null"
},
{
"type": "object"
}
]
}I further narrowed it down to this schema (in JS/JSON5 instead of JSON4, though I am still using the JSON4 plugin):
{
$schema: 'http://json-schema.org/draft-04/schema#',
properties: {
foo: {
additionalProperties: false,
properties: {
number: {
type: 'integer',
},
},
oneOf: [
{
type: 'null',
},
{
type: 'object'
},
],
},
},
additionalProperties: false,
oneOf: [
{
type: 'null',
},
{
type: 'object',
},
],
}Of note if you remove properties.oneOf and instead just use type: 'object' it will correctly show the error:
{
$schema: 'http://json-schema.org/draft-04/schema#',
properties: {
foo: {
additionalProperties: false,
properties: {
number: {
type: 'integer',
},
},
type: 'object'
},
},
additionalProperties: false,
oneOf: [
{
type: 'null',
},
{
type: 'object',
},
],
}Expected Behavior
An error should appear.
Actual Behavior
No error appears.

