Socket
Socket
Sign inDemoInstall

is-my-json-valid

Package Overview
Dependencies
5
Maintainers
4
Versions
64
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.12.4 to 2.13.0

3

index.js

@@ -8,3 +8,2 @@ var genobj = require('generate-object-property')

var get = function(obj, additionalSchemas, ptr) {
if (/^https?:\/\//.test(ptr)) return null

@@ -154,3 +153,3 @@ var visit = function(sub) {

if (verbose) {
validate('validate.errors.push({field:%s,message:%s,value:%s})', formatName(prop || name), JSON.stringify(msg), value || name)
validate('validate.errors.push({field:%s,message:%s,value:%s,type:%s})', formatName(prop || name), JSON.stringify(msg), value || name, JSON.stringify(type))
} else {

@@ -157,0 +156,0 @@ validate('validate.errors.push({field:%s,message:%s})', formatName(prop || name), JSON.stringify(msg))

{
"name": "is-my-json-valid",
"version": "2.12.4",
"version": "2.13.0",
"description": "A JSONSchema validator that uses code generation to be extremely fast",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -131,3 +131,3 @@ # is-my-json-valid

validate({hello: 100});
console.log(validate.errors) // {field: 'data.hello', message: 'is the wrong type', value: 100}
console.log(validate.errors) // {field: 'data.hello', message: 'is the wrong type', value: 100, type: 'string'}
```

@@ -134,0 +134,0 @@

@@ -101,2 +101,3 @@ var tape = require('tape')

t.ok(validate.errors[0].value === 'data.foo', 'should output the property not allowed in verbose mode')
t.strictEqual(validate.errors[0].type, 'object', 'error object should contain the type')
t.end()

@@ -282,2 +283,18 @@ })

tape('external schema URIs', function(t) {
var ext = {type: 'string'}
var schema = {
required: true,
$ref: 'http://example.com/schemas/schemaURIs'
}
var opts = {schemas:{}};
opts.schemas['http://example.com/schemas/schemaURIs'] = ext;
var validate = validator(schema, opts)
t.ok(validate('hello string'), 'is a string')
t.notOk(validate(42), 'not a string')
t.end()
})
tape('top-level external schema', function(t) {

@@ -359,2 +376,3 @@ var defs = {

t.strictEqual(validate.errors[0].value, 100, 'error object should contain the invalid value')
t.strictEqual(validate.errors[0].type, 'string', 'error object should contain the type')
t.end()

@@ -361,0 +379,0 @@ })

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc