Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

json-schema-merge-allof

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-schema-merge-allof - npm Package Compare versions

Comparing version 0.8.0 to 0.8.1

2

package.json
{
"name": "json-schema-merge-allof",
"version": "0.8.0",
"version": "0.8.1",
"description": "Simplify your schema by combining allOf into the root schema, safely.",

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

@@ -11,3 +11,2 @@ const cloneDeep = require('lodash/cloneDeep')

const isPlainObject = require('lodash/isPlainObject')
const isFunction = require('lodash/isFunction')
const pullAll = require('lodash/pullAll')

@@ -250,2 +249,7 @@ const sortBy = require('lodash/sortBy')

const defaultComplexResolvers = {
properties: propertiesResolver,
items: itemsResolver
}
function merger(rootSchema, options, totalSchemas) {

@@ -255,10 +259,8 @@ totalSchemas = totalSchemas || []

ignoreAdditionalProperties: false,
resolvers: cloneDeep(defaultResolvers),
resolvers: defaultResolvers,
complexResolvers: defaultComplexResolvers,
deep: true
})
const allResolverEntries = Object.entries(options.resolvers)
options.resolvers = Object.fromEntries(allResolverEntries.filter(([key, val]) => isFunction(val)))
const complexResolvers = allResolverEntries.filter(([key, val]) => isPlainObject(val))
options.complexResolvers = Object.fromEntries(complexResolvers)
const complexResolvers = Object.entries(options.complexResolvers)

@@ -295,4 +297,4 @@ function mergeSchemas(schemas, base, parents) {

const complexKeysArr = complexResolvers.map(([resolverKeyword, resolverConf]) =>
allKeys.filter(k => [resolverKeyword, ...resolverConf.keywords].includes(k)))
const complexKeysArr = complexResolvers.map(([mainKeyWord, resolverConf]) =>
allKeys.filter(k => resolverConf.keywords.includes(k)))

@@ -299,0 +301,0 @@ // remove all complex keys before simple resolvers

@@ -60,3 +60,3 @@ const chai = require('chai')

const opts = {
resolvers: {
complexResolvers: {
if: {

@@ -63,0 +63,0 @@ // test with same if-then-else resolver

@@ -40,4 +40,7 @@ const chai = require('chai')

}, {
resolvers: {
properties: stub
complexResolvers: {
properties: {
keywords: ['properties', 'patternProperties', 'additionalProperties'],
resolver: stub
}
}

@@ -44,0 +47,0 @@ })

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