Comparing version 8.6.0 to 8.6.1
@@ -25,2 +25,3 @@ import type { AddedKeywordDefinition, AnySchemaObject, KeywordErrorCxt, KeywordCxtParams } from "../../types"; | ||
result(condition: Code, successAction?: () => void, failAction?: () => void): void; | ||
failResult(condition: Code, successAction?: () => void, failAction?: () => void): void; | ||
pass(condition: Code, failAction?: () => void): void; | ||
@@ -27,0 +28,0 @@ fail(condition?: Code): void; |
@@ -306,3 +306,6 @@ "use strict"; | ||
result(condition, successAction, failAction) { | ||
this.gen.if(codegen_1.not(condition)); | ||
this.failResult(codegen_1.not(condition), successAction, failAction); | ||
} | ||
failResult(condition, successAction, failAction) { | ||
this.gen.if(condition); | ||
if (failAction) | ||
@@ -326,3 +329,3 @@ failAction(); | ||
pass(condition, failAction) { | ||
this.result(condition, undefined, failAction); | ||
this.failResult(codegen_1.not(condition), undefined, failAction); | ||
} | ||
@@ -329,0 +332,0 @@ fail(condition) { |
@@ -21,3 +21,3 @@ "use strict"; | ||
}, valid); | ||
cxt.result(valid, () => cxt.error(), () => cxt.reset()); | ||
cxt.failResult(valid, () => cxt.reset(), () => cxt.error()); | ||
}, | ||
@@ -24,0 +24,0 @@ error: { message: "must NOT be valid" }, |
@@ -372,3 +372,7 @@ import type { | ||
result(condition: Code, successAction?: () => void, failAction?: () => void): void { | ||
this.gen.if(not(condition)) | ||
this.failResult(not(condition), successAction, failAction) | ||
} | ||
failResult(condition: Code, successAction?: () => void, failAction?: () => void): void { | ||
this.gen.if(condition) | ||
if (failAction) failAction() | ||
@@ -387,3 +391,3 @@ else this.error() | ||
pass(condition: Code, failAction?: () => void): void { | ||
this.result(condition, undefined, failAction) | ||
this.failResult(not(condition), undefined, failAction) | ||
} | ||
@@ -390,0 +394,0 @@ |
@@ -29,6 +29,6 @@ import type {CodeKeywordDefinition, ErrorNoParams, AnySchema} from "../../types" | ||
cxt.result( | ||
cxt.failResult( | ||
valid, | ||
() => cxt.error(), | ||
() => cxt.reset() | ||
() => cxt.reset(), | ||
() => cxt.error() | ||
) | ||
@@ -35,0 +35,0 @@ }, |
{ | ||
"name": "ajv", | ||
"version": "8.6.0", | ||
"version": "8.6.1", | ||
"description": "Another JSON Schema Validator", | ||
@@ -5,0 +5,0 @@ "main": "dist/ajv.js", |
@@ -108,4 +108,4 @@ <img align="right" alt="Ajv logo" width="160" src="https://ajv.js.org/img/ajv.svg"> | ||
- [OpenAPI](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md) extensions: | ||
- NEW: keyword [discriminator](https://ajv.js.org/json-schema.md#discriminator). | ||
- keyword [nullable](https://ajv.js.org/json-schema.md#nullable). | ||
- NEW: keyword [discriminator](https://ajv.js.org/json-schema.html#discriminator). | ||
- keyword [nullable](https://ajv.js.org/json-schema.html#nullable). | ||
- full support of remote references (remote schemas have to be added with `addSchema` or compiled to be available) | ||
@@ -165,2 +165,7 @@ - support of recursive references between schemas | ||
const data = { | ||
foo: 1, | ||
bar: "abc" | ||
} | ||
const validate = ajv.compile(schema) | ||
@@ -167,0 +172,0 @@ const valid = validate(data) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
997724
19693
205