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

skhema

Package Overview
Dependencies
Maintainers
1
Versions
137
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

skhema - npm Package Compare versions

Comparing version 5.2.10-faulty-anyof-bug-c5b947d371954d36873cc920fa3ab3b07fe7ad38 to 5.2.10

2

CHANGELOG.md

@@ -10,3 +10,3 @@ # Change Log

* Fix bug where anyOf is matched incorrectly [Lucian Buzzo]
* .filter(): Only match if the base schema matches [Lucian Buzzo]

@@ -13,0 +13,0 @@ ## 5.2.9 - 2019-12-05

@@ -881,3 +881,3 @@ /*

// Create an instance of AJV that will be used to perform simple matchin
// Create an instance of AJV that will be used to perform simple matching
const matchAjv = new AJV({

@@ -943,22 +943,29 @@ allErrors: true,

for (const item of items) {
const matchers = collectMatchers(item, fragmentValidators)
const baseValidator = matchAjv.compile(
allowAdditionalProperties(clone(baseSchema))
)
// If no branches match we return the main schema validator
if (matchers.length === 0) {
if (filterValidator(item)) {
result.push(item)
}
} else {
// Otherwise we merge the branch fragments together to create a new filterValidator
const filterSchema = makeFilter(baseSchema, matchers)
// Only continue if the base schema matches
if (baseValidator(item)) {
const matchers = collectMatchers(item, fragmentValidators)
// Check if there are still `anyOf` branches to resolve
if (filterSchema.anyOf) {
return parse(filterSchema)
}
// If no branches match we return the main schema validator
if (matchers.length === 0) {
if (filterValidator(item)) {
result.push(item)
}
} else {
// Otherwise we merge the branch fragments together to create a new filterValidator
const filterSchema = makeFilter(baseSchema, matchers)
const mergedFilterValidator = filterAjv.compile(filterSchema)
// Check if there are still `anyOf` branches to resolve
if (filterSchema.anyOf) {
return parse(filterSchema)
}
if (mergedFilterValidator(item)) {
result.push(item)
const mergedFilterValidator = filterAjv.compile(filterSchema)
if (mergedFilterValidator(item)) {
result.push(item)
}
}

@@ -965,0 +972,0 @@ }

{
"name": "skhema",
"version": "5.2.10-faulty-anyof-bug-c5b947d371954d36873cc920fa3ab3b07fe7ad38",
"version": "5.2.10",
"description": "JSON Schema utility collection",

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

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