ajv
Advanced tools
Comparing version 7.0.2 to 7.0.3
@@ -7,3 +7,2 @@ "use strict"; | ||
const defaults_1 = require("./defaults"); | ||
const dataType_2 = require("./dataType"); | ||
const keyword_1 = require("./keyword"); | ||
@@ -35,3 +34,3 @@ const util_1 = require("../util"); | ||
gen.else(); | ||
dataType_2.reportTypeError(it); | ||
dataType_1.reportTypeError(it); | ||
} | ||
@@ -38,0 +37,0 @@ gen.endIf(); |
import type { CodeKeywordDefinition, ErrorObject, AnySchema } from "../../types"; | ||
export declare type OneOfError = ErrorObject<"oneOf", { | ||
passingSchemas: [number, number]; | ||
passingSchemas: [number, number] | null; | ||
}, AnySchema[]>; | ||
declare const def: CodeKeywordDefinition; | ||
export default def; |
@@ -90,3 +90,3 @@ # User defined keywords | ||
const eq: Code = parentSchema.exclusiveRange ? _`=` : nil | ||
gen.fail(_`${data} <${eq} ${min} || ${data} >${eq} ${max}`) | ||
cxt.fail(_`${data} <${eq} ${min} || ${data} >${eq} ${max}`) | ||
}, | ||
@@ -96,3 +96,3 @@ metaSchema: { | ||
items: [{type: "number"}, {type: "number"}], | ||
minItems: 2 | ||
minItems: 2, | ||
additionalItems: false, | ||
@@ -99,0 +99,0 @@ }, |
@@ -51,2 +51,3 @@ # Security considerations | ||
```javascript | ||
ajv = new Ajv({strictTypes: false}) // this option is required for this schema | ||
const isSchemaSecure = ajv.compile(require("ajv/lib/refs/json-schema-secure.json")) | ||
@@ -53,0 +54,0 @@ |
import type {SchemaObjCxt} from ".." | ||
import type {JSONType, Rule, RuleGroup} from "../rules" | ||
import {shouldUseGroup, shouldUseRule} from "./applicability" | ||
import {checkDataType} from "./dataType" | ||
import {checkDataType, reportTypeError} from "./dataType" | ||
import {assignDefaults} from "./defaults" | ||
import {reportTypeError} from "./dataType" | ||
import {keywordCode} from "./keyword" | ||
@@ -8,0 +7,0 @@ import {schemaHasRulesButRef} from "../util" |
@@ -12,3 +12,7 @@ import type { | ||
export type OneOfError = ErrorObject<"oneOf", {passingSchemas: [number, number]}, AnySchema[]> | ||
export type OneOfError = ErrorObject< | ||
"oneOf", | ||
{passingSchemas: [number, number] | null}, | ||
AnySchema[] | ||
> | ||
@@ -15,0 +19,0 @@ const error: KeywordErrorDefinition = { |
{ | ||
"name": "ajv", | ||
"version": "7.0.2", | ||
"version": "7.0.3", | ||
"description": "Another JSON Schema Validator", | ||
@@ -5,0 +5,0 @@ "main": "dist/ajv.js", |
@@ -77,2 +77,3 @@ <img align="right" alt="Ajv logo" width="160" src="https://ajv.js.org/images/ajv_logo.png"> | ||
- [Content Security Policy](./docs/security.md#content-security-policy) | ||
- [Using in ES5 environment](#using-in-es5-environment) | ||
- [Command line interface](#command-line-interface) | ||
@@ -311,2 +312,15 @@ - [API reference](./docs/api.md) | ||
## Using in ES5 environment | ||
You need to: | ||
- recompile Typescript to ES5 target - it is set to 2018 in the bundled compiled code. | ||
- generate ES5 validation code: | ||
```javascript | ||
const ajv = new Ajv({code: {es5: true}}) | ||
``` | ||
See [Advanced options](https://github.com/ajv-validator/ajv/blob/master/docs/api.md#advanced-options). | ||
## Command line interface | ||
@@ -313,0 +327,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
875320
14121
421