Comparing version 8.0.1 to 8.0.2
@@ -38,2 +38,3 @@ export declare abstract class _CodeOrName { | ||
export declare function getProperty(key: Code | string | number): Code; | ||
export declare function regexpCode(rx: RegExp): Code; | ||
export {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getProperty = exports.safeStringify = exports.stringify = exports.strConcat = exports.addCodeArg = exports.str = exports._ = exports.nil = exports._Code = exports.Name = exports.IDENTIFIER = exports._CodeOrName = void 0; | ||
exports.regexpCode = exports.getProperty = exports.safeStringify = exports.stringify = exports.strConcat = exports.addCodeArg = exports.str = exports._ = exports.nil = exports._Code = exports.Name = exports.IDENTIFIER = exports._CodeOrName = void 0; | ||
class _CodeOrName { | ||
@@ -143,2 +143,6 @@ } | ||
exports.getProperty = getProperty; | ||
function regexpCode(rx) { | ||
return new _Code(rx.toString()); | ||
} | ||
exports.regexpCode = regexpCode; | ||
//# sourceMappingURL=code.js.map |
import type { ScopeValueSets, NameValue, ValueScope, ValueScopeName } from "./scope"; | ||
import { _Code, Code, Name } from "./code"; | ||
import { Scope } from "./scope"; | ||
export { _, str, strConcat, nil, getProperty, stringify, Name, Code } from "./code"; | ||
export { _, str, strConcat, nil, getProperty, stringify, regexpCode, Name, Code } from "./code"; | ||
export { Scope, ScopeStore, ValueScope, ValueScopeName, ScopeValueSets, varKinds } from "./scope"; | ||
@@ -6,0 +6,0 @@ export declare type SafeExpr = Code | number | boolean | null; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.or = exports.and = exports.not = exports.CodeGen = exports.operators = exports.varKinds = exports.ValueScopeName = exports.ValueScope = exports.Scope = exports.Name = exports.stringify = exports.getProperty = exports.nil = exports.strConcat = exports.str = exports._ = void 0; | ||
exports.or = exports.and = exports.not = exports.CodeGen = exports.operators = exports.varKinds = exports.ValueScopeName = exports.ValueScope = exports.Scope = exports.Name = exports.regexpCode = exports.stringify = exports.getProperty = exports.nil = exports.strConcat = exports.str = exports._ = void 0; | ||
const code_1 = require("./code"); | ||
@@ -13,2 +13,3 @@ const scope_1 = require("./scope"); | ||
Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return code_2.stringify; } }); | ||
Object.defineProperty(exports, "regexpCode", { enumerable: true, get: function () { return code_2.regexpCode; } }); | ||
Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return code_2.Name; } }); | ||
@@ -15,0 +16,0 @@ var scope_2 = require("./scope"); |
@@ -41,7 +41,8 @@ "use strict"; | ||
function checkStrictTuple(sch) { | ||
const { opts, errSchemaPath } = it; | ||
const l = schArr.length; | ||
const fullTuple = l === sch.minItems && (l === sch.maxItems || sch[extraItems] === false); | ||
if (it.opts.strictTuples && !fullTuple) { | ||
const msg = `"${keyword}" is ${l}-tuple, but minItems or maxItems/${extraItems} are not specified or different`; | ||
util_1.checkStrictMode(it, msg, it.opts.strictTuples); | ||
if (opts.strictTuples && !fullTuple) { | ||
const msg = `"${keyword}" is ${l}-tuple, but minItems or maxItems/${extraItems} are not specified or different at path "${errSchemaPath}"`; | ||
util_1.checkStrictMode(it, msg, opts.strictTuples); | ||
} | ||
@@ -48,0 +49,0 @@ } |
@@ -69,7 +69,8 @@ "use strict"; | ||
function getFormat(fmtDef) { | ||
const fmt = gen.scopeValue("formats", { | ||
key: schema, | ||
ref: fmtDef, | ||
code: opts.code.formats ? codegen_1._ `${opts.code.formats}${codegen_1.getProperty(schema)}` : undefined, | ||
}); | ||
const code = fmtDef instanceof RegExp | ||
? codegen_1.regexpCode(fmtDef) | ||
: opts.code.formats | ||
? codegen_1._ `${opts.code.formats}${codegen_1.getProperty(schema)}` | ||
: undefined; | ||
const fmt = gen.scopeValue("formats", { key: schema, ref: fmtDef, code }); | ||
if (typeof fmtDef == "object" && !(fmtDef instanceof RegExp)) { | ||
@@ -76,0 +77,0 @@ return [fmtDef.type || "string", fmtDef.validate, codegen_1._ `${fmt}.validate`]; |
@@ -157,1 +157,5 @@ export abstract class _CodeOrName { | ||
} | ||
export function regexpCode(rx: RegExp): Code { | ||
return new _Code(rx.toString()) | ||
} |
@@ -5,3 +5,3 @@ import type {ScopeValueSets, NameValue, ValueScope, ValueScopeName} from "./scope" | ||
export {_, str, strConcat, nil, getProperty, stringify, Name, Code} from "./code" | ||
export {_, str, strConcat, nil, getProperty, stringify, regexpCode, Name, Code} from "./code" | ||
export {Scope, ScopeStore, ValueScope, ValueScopeName, ScopeValueSets, varKinds} from "./scope" | ||
@@ -8,0 +8,0 @@ |
@@ -49,7 +49,8 @@ import type {CodeKeywordDefinition, AnySchema, AnySchemaObject} from "../../types" | ||
function checkStrictTuple(sch: AnySchemaObject): void { | ||
const {opts, errSchemaPath} = it | ||
const l = schArr.length | ||
const fullTuple = l === sch.minItems && (l === sch.maxItems || sch[extraItems] === false) | ||
if (it.opts.strictTuples && !fullTuple) { | ||
const msg = `"${keyword}" is ${l}-tuple, but minItems or maxItems/${extraItems} are not specified or different` | ||
checkStrictMode(it, msg, it.opts.strictTuples) | ||
if (opts.strictTuples && !fullTuple) { | ||
const msg = `"${keyword}" is ${l}-tuple, but minItems or maxItems/${extraItems} are not specified or different at path "${errSchemaPath}"` | ||
checkStrictMode(it, msg, opts.strictTuples) | ||
} | ||
@@ -56,0 +57,0 @@ } |
@@ -10,3 +10,3 @@ import type { | ||
import type {KeywordCxt} from "../../compile/validate" | ||
import {_, str, nil, or, Code, getProperty} from "../../compile/codegen" | ||
import {_, str, nil, or, Code, getProperty, regexpCode} from "../../compile/codegen" | ||
@@ -96,7 +96,9 @@ type FormatValidate = | ||
function getFormat(fmtDef: AddedFormat): [string, FormatValidate, Code] { | ||
const fmt = gen.scopeValue("formats", { | ||
key: schema, | ||
ref: fmtDef, | ||
code: opts.code.formats ? _`${opts.code.formats}${getProperty(schema)}` : undefined, | ||
}) | ||
const code = | ||
fmtDef instanceof RegExp | ||
? regexpCode(fmtDef) | ||
: opts.code.formats | ||
? _`${opts.code.formats}${getProperty(schema)}` | ||
: undefined | ||
const fmt = gen.scopeValue("formats", {key: schema, ref: fmtDef, code}) | ||
if (typeof fmtDef == "object" && !(fmtDef instanceof RegExp)) { | ||
@@ -103,0 +105,0 @@ return [fmtDef.type || "string", fmtDef.validate, _`${fmt}.validate`] |
{ | ||
"name": "ajv", | ||
"version": "8.0.1", | ||
"version": "8.0.2", | ||
"description": "Another JSON Schema Validator", | ||
@@ -5,0 +5,0 @@ "main": "dist/ajv.js", |
@@ -116,3 +116,3 @@ <img align="right" alt="Ajv logo" width="160" src="https://ajv.js.org/img/ajv.svg"> | ||
To install version 7: | ||
To install version 8: | ||
@@ -158,4 +158,6 @@ ``` | ||
**Please note**: [Changes in version 7.0.0](https://github.com/ajv-validator/ajv/releases/tag/v7.0.0) | ||
**Please note**: [Changes in version 8.0.0](https://github.com/ajv-validator/ajv/releases/tag/v8.0.0) | ||
[Version 7.0.0](https://github.com/ajv-validator/ajv/releases/tag/v7.0.0) | ||
[Version 6.0.0](https://github.com/ajv-validator/ajv/releases/tag/v6.0.0). | ||
@@ -162,0 +164,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
986792
19495
182