validate-value
Advanced tools
Comparing version 8.3.0 to 8.4.0
@@ -45,2 +45,20 @@ "use strict"; | ||
} | ||
case 'maxLength': { | ||
const maxPropertyLength = error.params.limit; | ||
const actualLength = failingValue.length; | ||
message = `String is too long (${actualLength} chars), maximum ${maxPropertyLength}`; | ||
break; | ||
} | ||
case 'minimum': { | ||
const minimumValue = error.params.limit; | ||
const actualValue = failingValue; | ||
message = `Value ${actualValue} is less than minimum ${minimumValue}`; | ||
break; | ||
} | ||
case 'maximum': { | ||
const maximumValue = error.params.limit; | ||
const actualValue = failingValue; | ||
message = `Value ${actualValue} is more than maximum ${maximumValue}`; | ||
break; | ||
} | ||
default: { | ||
@@ -47,0 +65,0 @@ // Intentionally left blank. |
@@ -0,1 +1,8 @@ | ||
# [8.4.0](https://github.com/thenativeweb/validate-value/compare/8.3.0...8.4.0) (2020-11-20) | ||
### Features | ||
* Add error messages for maxLength, minimum and maximum. ([#218](https://github.com/thenativeweb/validate-value/issues/218)) ([0b4c116](https://github.com/thenativeweb/validate-value/commit/0b4c116f71516a352972676e2863ee2334f7df24)) | ||
# [8.3.0](https://github.com/thenativeweb/validate-value/compare/8.2.0...8.3.0) (2020-11-13) | ||
@@ -2,0 +9,0 @@ |
@@ -64,2 +64,29 @@ import Ajv from 'ajv'; | ||
case 'maxLength': { | ||
const maxPropertyLength = (error.params as Ajv.LimitParams).limit; | ||
const actualLength = failingValue.length; | ||
message = `String is too long (${actualLength} chars), maximum ${maxPropertyLength}`; | ||
break; | ||
} | ||
case 'minimum': { | ||
const minimumValue = (error.params as Ajv.LimitParams).limit; | ||
const actualValue = failingValue; | ||
message = `Value ${actualValue} is less than minimum ${minimumValue}`; | ||
break; | ||
} | ||
case 'maximum': { | ||
const maximumValue = (error.params as Ajv.LimitParams).limit; | ||
const actualValue = failingValue; | ||
message = `Value ${actualValue} is more than maximum ${maximumValue}`; | ||
break; | ||
} | ||
default: { | ||
@@ -66,0 +93,0 @@ // Intentionally left blank. |
{ | ||
"name": "validate-value", | ||
"version": "8.3.0", | ||
"version": "8.4.0", | ||
"description": "validate-value validates values against JSON schemas.", | ||
@@ -31,4 +31,4 @@ "contributors": [ | ||
"assertthat": "5.2.5", | ||
"roboter": "11.5.8", | ||
"semantic-release-configuration": "1.0.25" | ||
"roboter": "11.5.11", | ||
"semantic-release-configuration": "1.0.26" | ||
}, | ||
@@ -35,0 +35,0 @@ "repository": { |
21343
323