-
Notifications
You must be signed in to change notification settings - Fork 7
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
Quick Schema fixes #201
Quick Schema fixes #201
Conversation
New and removed dependencies detected. Learn more about Socket for GitHub ↗︎
🚮 Removed packages: npm/@babel/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@typescript-eslint/[email protected], npm/@typescript-eslint/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected] |
}, | ||
"lastSeenOn": { | ||
"description": "The timestamp (in milliseconds since epoch) when the device either last checked in or was scanned.", | ||
"type": ["number", "null"], | ||
"format": "date-time" | ||
} | ||
}, | ||
"lastSeenOn": { | ||
"description": "The timestamp (in milliseconds since epoch) when the device either last checked in or was scanned.", | ||
"type": ["number", "null"], | ||
"format": "date-time" | ||
}, | ||
"required": ["function", "lastSeenOn"] |
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.
this was living outside the properties
key...
@@ -9,8 +9,7 @@ | |||
}, | |||
{ | |||
"properties": {}, | |||
"required": [], | |||
"excludes": [] |
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.
excludes
is causing issues with AJV, and while this is not a solution, but it will minimize the number of errors that we're getting.
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.
We'll have to figure out a proper way to support this functionality eventually though.
@@ -1,6 +1,6 @@ | |||
{ | |||
"name": "@jupiterone/data-model", | |||
"version": "0.56.1", | |||
"version": "0.57.0", |
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.
Alright so, this is weird. I don't know if this is considered a breaking change or not, but I don't think it is.
Moving the HostAgent's lastSeenOn
inside the properties
key is technically adding a new field that didn't exist before.
But also, the schema was mentioning the lastSeenOn
inside the required
properties list...
To be able to tell if it's a breaking change or not, we'd have to understand how existing consumers of the HostAgent schema handle a required property that isn't actually defined in the schema's properties
.
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.
const Ajv = require('ajv');
const ajv = new Ajv({
// extendRefs: true
});
ajv.addSchema({
"title": "test",
"type": "object",
"properties": {
"abc": {
"type": "string"
}
},
"required": ["test"]
}
, 'a.json');
console.log(ajv.validate('a.json', {}));
console.log(ajv.validate('a.json', { test: 1 }));
console.log(ajv.validate('a.json', { test: true }));
console.log(ajv.validate('a.json', { test: 'string' }));
false
true
true
true
Looks like AJV considers this as requiring the property to be present but no restriction on the type.
No description provided.