-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expected type not working #69
Comments
I will look into this bug - thanks for reporting! I didn't know oneOf could be represented this way tbh, haha! I see this is valid, but usually I would do this (I wonder if this also isn't working?) {
$schema: 'http://json-schema.org/draft-04/schema#',
properties: {
foo: {
oneOf: [
{
type: 'object',
additionalProperties: false,
properties: {
number: {
type: 'integer',
},
},
{
type: 'null'
},
],
},
},
additionalProperties: false,
oneOf: [
{
type: 'null',
},
{
type: 'object',
},
],
} but your generated schema def is also valid. I will see what I can do, starting with some tests! |
this one is going to take some time because it requires rewriting some of our pointer functions to pick up the root @imolorhe what do you think of making the object root a pointer - i think it will solve issues like these ultimately, and thus we can be in compatibility with some major json schema specs that have top level complex types or refs (top level |
No issues there from me. |
I dug into this a bit further, and I think the issue is upstream in |
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:
I further narrowed it down to this schema (in JS/JSON5 instead of JSON4, though I am still using the JSON4 plugin):
Of note if you remove
properties.oneOf
and instead just usetype: 'object'
it will correctly show the error:Expected Behavior
An error should appear.
Actual Behavior
No error appears.
The text was updated successfully, but these errors were encountered: