-
Notifications
You must be signed in to change notification settings - Fork 263
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
Handling of object type (Boolean, String, Number) #351
base: master
Are you sure you want to change the base?
Conversation
add handling with object type (Boolean, String, Number)
fix Number is integer
I'll have to research this a bit, this may be a breaking change. Boolean, String, and Number are objects in many respects and this may break some implementations. |
@@ -1,14 +1,18 @@ | |||
'use strict'; | |||
|
|||
// BUG: quick fix | |||
Error.captureStackTrace = () => { }; |
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.
What bug is this fixing? We can't modify the builtin objects (Error, Number, Math, etc), this could interfere with other libraries in the same environment.
var ValidationError = exports.ValidationError = function ValidationError (message, instance, schema, path, name, argument) { | ||
if(Array.isArray(path)){ | ||
var ValidationError = exports.ValidationError = function ValidationError(message, instance, schema, path, name, argument) { | ||
if (Array.isArray(path)) { |
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.
Please try to keep changes strictly relevant to the purpose of the PR... avoid making whitespace changes. We can consider these sorts of changes, but this is best done in a separate task.
@@ -1,7 +1,7 @@ | |||
{ | |||
"author": "Tom de Grunt <[email protected]>", | |||
"name": "jsonschema", | |||
"version": "1.4.0", | |||
"version": "1.4.1", |
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.
Pull requests don't need to touch this file, we can do that at the appropriate time.
@@ -39,4 +39,4 @@ | |||
"stryker": "stryker run", | |||
"test": "./node_modules/.bin/mocha -R spec" | |||
} | |||
} | |||
} |
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.
And finally, make sure lines are terminated with a newline. Git has trouble with lines that are missing a newline character at the end.
Because we need some information and store it in the types, we need object types like Boolean, String and Number. So that the jsonschema can handle these types, the validation had to have this knowledge.