-
Notifications
You must be signed in to change notification settings - Fork 136
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
Updated metaschema to improve error reporting #1027
Updated metaschema to improve error reporting #1027
Conversation
This is the basically the prior approach, it seems? I believe this will incorrectly allow extra top-level attributes though the JSON Schema check. |
It is not the prior approach, though it does use the same technique. I believe the prior approach allowed extra top-level attributes in objects because nothing in the definition of The difference here is that both event and object now / still inherit from the common event object schema, which defines the attributes, and are both able to set Below are test cases I wrote up locally (I could contribute these to the validator unit tests at some point). If there are other tests you'd like me to work through or if I'm missing something about the problem you ran into before let me know! An event should not pass with additional top-level properties{
"description": "Bad apple: an invalid event.",
"extends": "base_event",
"caption": "Bad Apple",
"name": "bad_apple",
"category": "network",
"uid": 999,
"profiles": [
"host"
],
"attributes": {
"file": {
"description": "The email file attachment.",
"group": "primary",
"requirement": "required"
}
},
"foo": "bar"
} results in:
An object should not pass with additional top-level properties{
"description": "Bad apple: an invalid object.",
"extends": "object",
"caption": "Bad Apple",
"name": "bad_apple",
"profiles": [
"host"
],
"attributes": {
"file": {
"description": "The email file attachment.",
"group": "primary",
"requirement": "required"
}
},
"foo": "bar"
} results in:
An attribute that combines
|
I tried this locally, and it works great. I say we go with it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Alan!
Related Issue:
Fixes #1021
Description of changes:
This PR updates the
event
andobject
metaschemas to address the issue described in #1021, where reporting from the metaschema validation does not point to the location of the error. The strategy used is shown here: https://json-schema.org/understanding-json-schema/reference/object#extending