Skip to content
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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

vwensel
Copy link

@vwensel vwensel commented Oct 13, 2021

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.

@awwright
Copy link
Collaborator

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.
On the flip side, this may be a good time to add support for BigInt.

@@ -1,14 +1,18 @@
'use strict';

// BUG: quick fix
Error.captureStackTrace = () => { };
Copy link
Collaborator

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)) {
Copy link
Collaborator

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",
Copy link
Collaborator

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"
}
}
}
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants