New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

json-schema-library

Package Overview
Dependencies
Maintainers
2
Versions
94
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-schema-library - npm Package Compare versions

Comparing version 7.4.3 to 7.4.4

dist/lib/utils/isEmpty.d.ts

32

dist/module/lib/getTemplate.js

@@ -8,2 +8,3 @@ /* eslint quote-props: 0, max-statements-per-line: ["error", { "max": 2 }] */

import { isJSONError } from "./types";
import { isEmpty } from "./utils/isEmpty";
const defaultOptions = {

@@ -123,15 +124,24 @@ addOptionalProps: true,

}
if (schema.oneOf) {
// find correct schema for data
const resolvedSchema = resolveOneOfFuzzy(core, data, schema);
if (isJSONError(resolvedSchema)) {
if (data != null && opts.removeInvalidData !== true) {
return data;
}
// override
schema = schema.oneOf[0];
data = undefined;
if (Array.isArray(schema.oneOf)) {
if (isEmpty(data)) {
const type = schema.oneOf[0].type ||
schema.type ||
(schema.const && typeof schema.const) ||
getTypeOf(data);
schema = { ...schema.oneOf[0], type };
}
else {
schema = resolvedSchema;
// find correct schema for data
const resolvedSchema = resolveOneOfFuzzy(core, data, schema);
if (isJSONError(resolvedSchema)) {
if (data != null && opts.removeInvalidData !== true) {
return data;
}
// override
schema = schema.oneOf[0];
data = undefined;
}
else {
schema = resolvedSchema;
}
}

@@ -138,0 +148,0 @@ }

@@ -121,3 +121,3 @@ import getTypeOf from "./getTypeOf";

const dependentProperty = dependentProperties[i];
const schema = step(core, key, dependencies[dependentProperty], data);
const schema = step(core, key, dependencies[dependentProperty], data, `${pointer}/${dependentProperty}`);
if (!isJSONError(schema)) {

@@ -124,0 +124,0 @@ return schema;

@@ -9,2 +9,3 @@ /* eslint quote-props: 0, max-statements-per-line: ["error", { "max": 2 }] */

import { Draft as Core } from "./draft";
import { isEmpty } from "./utils/isEmpty";

@@ -161,14 +162,23 @@ export type TemplateOptions = {

if (schema.oneOf) {
// find correct schema for data
const resolvedSchema = resolveOneOfFuzzy(core, data, schema);
if (isJSONError(resolvedSchema)) {
if (data != null && opts.removeInvalidData !== true) {
return data;
if (Array.isArray(schema.oneOf)) {
if (isEmpty(data)) {
const type =
schema.oneOf[0].type ||
schema.type ||
(schema.const && typeof schema.const) ||
getTypeOf(data);
schema = { ...schema.oneOf[0], type };
} else {
// find correct schema for data
const resolvedSchema = resolveOneOfFuzzy(core, data, schema);
if (isJSONError(resolvedSchema)) {
if (data != null && opts.removeInvalidData !== true) {
return data;
}
// override
schema = schema.oneOf[0];
data = undefined;
} else {
schema = resolvedSchema;
}
// override
schema = schema.oneOf[0];
data = undefined;
} else {
schema = resolvedSchema;
}

@@ -175,0 +185,0 @@ }

@@ -171,3 +171,9 @@ import getTypeOf from "./getTypeOf";

const dependentProperty = dependentProperties[i];
const schema = step(core, key, dependencies[dependentProperty], data);
const schema = step(
core,
key,
dependencies[dependentProperty],
data,
`${pointer}/${dependentProperty}`
);
if (!isJSONError(schema)) {

@@ -174,0 +180,0 @@ return schema;

{
"name": "json-schema-library",
"version": "7.4.3",
"version": "7.4.4",
"description": "Customizable and hackable json-validator and json-schema utilities for traversal, data generation and validation",

@@ -5,0 +5,0 @@ "module": "dist/module/index.js",

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc