Socket
Socket
Sign inDemoInstall

validate-value

Package Overview
Dependencies
Maintainers
3
Versions
91
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

validate-value - npm Package Compare versions

Comparing version 7.2.1 to 7.3.0

22

build/lib/Value.js

@@ -24,8 +24,18 @@ "use strict";

let message = 'Validation failed';
if (error.keyword === 'required') {
const missingPropertyName = error.params.missingProperty;
message = `Missing required property: ${missingPropertyName}`;
// Ajv treats missing required properties as errors on the object that should have the property, so the name of
// the missing property is missing in the data path and must be appended.
updatedPath += `${separator}${missingPropertyName}`;
switch (error.keyword) {
case 'required': {
const missingPropertyName = error.params.missingProperty;
message = `Missing required property: ${missingPropertyName}`;
updatedPath += `${separator}${missingPropertyName}`;
break;
}
case 'additionalProperties': {
const additionalPropertyName = error.params.additionalProperty;
message = `Unexpected additional property: ${additionalPropertyName}`;
updatedPath += `${separator}${additionalPropertyName}`;
break;
}
default: {
// Intentionally left blank.
}
}

@@ -32,0 +42,0 @@ throw new ValidationError_1.ValidationError(`${message} (at ${updatedPath}).`, error);

@@ -0,1 +1,8 @@

# [7.3.0](https://github.com/thenativeweb/validate-value/compare/7.2.1...7.3.0) (2020-10-09)
### Features
* Add more error messages. ([#182](https://github.com/thenativeweb/validate-value/issues/182)) ([b7e6e1f](https://github.com/thenativeweb/validate-value/commit/b7e6e1f43aea1a0349c2791ea86db3a07bdde13a))
## [7.2.1](https://github.com/thenativeweb/validate-value/compare/7.2.0...7.2.1) (2020-10-08)

@@ -2,0 +9,0 @@

@@ -34,10 +34,24 @@ import Ajv from 'ajv';

if (error.keyword === 'required') {
const missingPropertyName = (error.params as Ajv.RequiredParams).missingProperty;
switch (error.keyword) {
case 'required': {
const missingPropertyName = (error.params as Ajv.RequiredParams).missingProperty;
message = `Missing required property: ${missingPropertyName}`;
message = `Missing required property: ${missingPropertyName}`;
updatedPath += `${separator}${missingPropertyName}`;
// Ajv treats missing required properties as errors on the object that should have the property, so the name of
// the missing property is missing in the data path and must be appended.
updatedPath += `${separator}${missingPropertyName}`;
break;
}
case 'additionalProperties': {
const additionalPropertyName = (error.params as Ajv.AdditionalPropertiesParams).additionalProperty;
message = `Unexpected additional property: ${additionalPropertyName}`;
updatedPath += `${separator}${additionalPropertyName}`;
break;
}
default: {
// Intentionally left blank.
}
}

@@ -44,0 +58,0 @@

{
"name": "validate-value",
"version": "7.2.1",
"version": "7.3.0",
"description": "validate-value validates values against JSON schemas.",

@@ -5,0 +5,0 @@ "contributors": [

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