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

@finnair/v-validation

Package Overview
Dependencies
Maintainers
0
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@finnair/v-validation - npm Package Compare versions

Comparing version 7.0.0-alpha.5 to 7.0.0-alpha.6

7

CHANGELOG.md

@@ -6,2 +6,9 @@ # Change Log

# [7.0.0-alpha.6](https://github.com/finnair/v-validation/compare/v7.0.0-alpha.5...v7.0.0-alpha.6) (2024-11-18)
### Bug Fixes
- some validators throwing instead of returning Promise.reject ([c00876d](https://github.com/finnair/v-validation/commit/c00876ddb77d8deefcf38c8e9a05749b8c7f1cff))
- V.emptyTo typing ([c5a81f4](https://github.com/finnair/v-validation/commit/c5a81f4e5354570d0b331e31a8367fdb52464505))
# [7.0.0-alpha.5](https://github.com/finnair/v-validation/compare/v7.0.0-alpha.4...v7.0.0-alpha.5) (2024-11-14)

@@ -8,0 +15,0 @@

6

dist/cjs/schema.js

@@ -50,3 +50,3 @@ "use strict";

if ((0, validators_js_1.isNullOrUndefined)(value)) {
throw validators_js_1.defaultViolations.notNull(path);
return Promise.reject(validators_js_1.defaultViolations.notNull(path));
}

@@ -65,3 +65,3 @@ // 1) Validate discriminator

if (!validator) {
throw new DiscriminatorViolation(typePath, type, Object.keys(this.validators));
return Promise.reject(new DiscriminatorViolation(typePath, type, Object.keys(this.validators)));
}

@@ -72,3 +72,3 @@ // 2) Validate that the type is assignable to the expected type (polymorphism)

if (!this.isSubtypeOf(validator, expectedParent)) {
throw new validators_js_1.TypeMismatch(path, expectedType, type);
return Promise.reject(new validators_js_1.TypeMismatch(path, expectedType, type));
}

@@ -75,0 +75,0 @@ }

@@ -44,5 +44,5 @@ import { SchemaValidator, SchemaModel } from './schema.js';

undefinedToNull: () => ValueMapper<any, any>;
emptyTo: <InOut extends {
emptyTo: <In extends {
length: number;
}>(defaultValue: InOut) => ValueMapper<InOut, InOut>;
}, Default = In>(defaultValue: Default) => ValueMapper<In | Default, In | null | undefined>;
uuid: (version?: number) => UuidValidator;

@@ -49,0 +49,0 @@ pattern: (pattern: string | RegExp, flags?: string) => PatternValidator;

@@ -45,3 +45,3 @@ import { Validator, isNullOrUndefined, defaultViolations, isString, Violation, TypeMismatch, } from './validators.js';

if (isNullOrUndefined(value)) {
throw defaultViolations.notNull(path);
return Promise.reject(defaultViolations.notNull(path));
}

@@ -60,3 +60,3 @@ // 1) Validate discriminator

if (!validator) {
throw new DiscriminatorViolation(typePath, type, Object.keys(this.validators));
return Promise.reject(new DiscriminatorViolation(typePath, type, Object.keys(this.validators)));
}

@@ -67,3 +67,3 @@ // 2) Validate that the type is assignable to the expected type (polymorphism)

if (!this.isSubtypeOf(validator, expectedParent)) {
throw new TypeMismatch(path, expectedType, type);
return Promise.reject(new TypeMismatch(path, expectedType, type));
}

@@ -70,0 +70,0 @@ }

@@ -44,5 +44,5 @@ import { SchemaValidator, SchemaModel } from './schema.js';

undefinedToNull: () => ValueMapper<any, any>;
emptyTo: <InOut extends {
emptyTo: <In extends {
length: number;
}>(defaultValue: InOut) => ValueMapper<InOut, InOut>;
}, Default = In>(defaultValue: Default) => ValueMapper<In | Default, In | null | undefined>;
uuid: (version?: number) => UuidValidator;

@@ -49,0 +49,0 @@ pattern: (pattern: string | RegExp, flags?: string) => PatternValidator;

{
"name": "@finnair/v-validation",
"version": "7.0.0-alpha.5",
"version": "7.0.0-alpha.6",
"private": false,

@@ -51,5 +51,5 @@ "description": "V-validation core package",

"devDependencies": {
"@finnair/path": "^7.0.0-alpha.5"
"@finnair/path": "^7.0.0-alpha.6"
},
"gitHead": "852a94df835ad85ce3f4ac92a285403f57ca3d02"
"gitHead": "468a1d6fd29ab8ec10915603731dee7a07dac97c"
}

@@ -37,6 +37,9 @@ ![CI](https://github.com/finnair/v-validation/workflows/CI/badge.svg?branch=master)

### Breaking changes:
* V.string() and some other validators do not support String object as input any more.
* V.number() does not support Number object as input any more.
* V.allOf() requires that all results match
* `V.string()` and some other validators do not support String object as input any more.
* `isString()` function doesn't support String object any more
* `V.number()` does not support Number object as input any more.
* `V.allOf()` requires that all results match
* Validators that accept multiple subvalidators (`V.optional`, `V.required`, `V.check`, `V.if`, `V.whenGroup`, `V.json` and `ObjectModel#next`) are combined using `V.compositionOf` instead of `V.allOf` as composition makes more sense in general. However, if there are multiple parents with next validators, those are still combined with `V.allOf` as they are not aware of each other.
* `V.if` does not support "fall through" any more but rejects with NoMatchingCondition if no condition matches. Use `.else(V.any())` if "fall through" is desirable.
* `V.whenGroup` does not support "fall through" any more but rejects with NoMatchingGroup if no condition matches. Use `.otherwise(V.any())` if "fall through" is desirable.
* More straightforward internal architecture:

@@ -43,0 +46,0 @@ * Internal Validator#validatePath returns now a Promise of valid value or reject of Violation(s) directly instead of ValidationResult

Sorry, the diff of this file is not supported yet

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