ajv
- Version 8.17.1
- Published
- 1.03 MB
- 4 dependencies
- MIT license
Install
npm i ajvyarn add ajvpnpm add ajvOverview
Another JSON Schema Validator
Index
Variables
Functions
Classes
Interfaces
Type Aliases
Variables
variable nil
const nil: _Code;Functions
Classes
class Ajv
class Ajv extends AjvCore {}method defaultMeta
defaultMeta: () => string | AnySchemaObject | undefined;class CodeGen
class CodeGen {}constructor
constructor(extScope: ValueScope, opts?: CodeGenOptions);method add
add: (lhs: Code, rhs: SafeExpr) => CodeGen;method assign
assign: (lhs: Code, rhs: SafeExpr, sideEffects?: boolean) => CodeGen;method block
block: (body?: Block, nodeCount?: number) => CodeGen;method break
break: (label?: Code) => CodeGen;method code
code: (c: Block | SafeExpr) => CodeGen;method const
const: (nameOrPrefix: Name | string, rhs: SafeExpr, _constant?: boolean) => Name;method else
else: () => CodeGen;method elseIf
elseIf: (condition: Code | boolean) => CodeGen;method endBlock
endBlock: (nodeCount?: number) => CodeGen;method endFor
endFor: () => CodeGen;method endFunc
endFunc: () => CodeGen;method endIf
endIf: () => CodeGen;method for
for: (iteration: Code, forBody?: Block) => CodeGen;method forIn
forIn: ( nameOrPrefix: Name | string, obj: Code, forBody: (item: Name) => void, varKind?: Code) => CodeGen;method forOf
forOf: ( nameOrPrefix: Name | string, iterable: Code, forBody: (item: Name) => void, varKind?: Code) => CodeGen;method forRange
forRange: ( nameOrPrefix: Name | string, from: SafeExpr, to: SafeExpr, forBody: (index: Name) => void, varKind?: Code) => CodeGen;method func
func: (name: Name, args?: Code, async?: boolean, funcBody?: Block) => CodeGen;method getScopeValue
getScopeValue: (prefix: string, keyOrRef: unknown) => ValueScopeName | undefined;method if
if: (condition: Code | boolean, thenBody?: Block, elseBody?: Block) => CodeGen;method label
label: (label: Name) => CodeGen;method let
let: (nameOrPrefix: Name | string, rhs?: SafeExpr, _constant?: boolean) => Name;method name
name: (prefix: string) => Name;method object
object: (...keyValues: [Name | string, SafeExpr | string][]) => _Code;method optimize
optimize: (n?: number) => void;method return
return: (value: Block | SafeExpr) => CodeGen;method scopeCode
scopeCode: () => Code;method scopeName
scopeName: (prefix: string) => ValueScopeName;method scopeRefs
scopeRefs: (scopeName: Name) => Code;method scopeValue
scopeValue: (prefixOrName: ValueScopeName | string, value: NameValue) => Name;method throw
throw: (error: Code) => CodeGen;method toString
toString: () => string;method try
try: ( tryBody: Block, catchCode?: (e: Name) => void, finallyCode?: Block) => CodeGen;method var
var: (nameOrPrefix: Name | string, rhs?: SafeExpr, _constant?: boolean) => Name;class KeywordCxt
class KeywordCxt implements KeywordErrorCxt {}constructor
constructor(it: SchemaObjCxt, def: AddedKeywordDefinition, keyword: string);property $data
readonly $data?: string | false;property allErrors
readonly allErrors?: boolean;property data
readonly data: Name;property def
readonly def: AddedKeywordDefinition;property errsCount
readonly errsCount?: Name;property gen
readonly gen: CodeGen;property it
readonly it: SchemaObjCxt;property keyword
readonly keyword: string;property params
params: KeywordCxtParams;property parentSchema
readonly parentSchema: AnySchemaObject;property schema
schema: any;property schemaCode
readonly schemaCode: number | boolean | Code;property schemaType
readonly schemaType: ( | 'string' | 'number' | 'boolean' | 'object' | 'integer' | 'null' | 'array')[];property schemaValue
readonly schemaValue: number | boolean | Code;method $dataError
$dataError: () => void;method block$data
block$data: (valid: Name, codeBlock: () => void, $dataValid?: Code) => void;method check$data
check$data: (valid?: Name, $dataValid?: Code) => void;method error
error: ( append?: boolean, errorParams?: KeywordCxtParams, errorPaths?: ErrorPaths) => void;method fail
fail: (condition?: Code) => void;method fail$data
fail$data: (condition: Code) => void;method failResult
failResult: ( condition: Code, successAction?: () => void, failAction?: () => void) => void;method invalid$data
invalid$data: () => Code;method mergeEvaluated
mergeEvaluated: (schemaCxt: SchemaCxt, toName?: typeof Name) => void;method mergeValidEvaluated
mergeValidEvaluated: (schemaCxt: SchemaCxt, valid: Name) => boolean | void;method ok
ok: (cond: Code | boolean) => void;method pass
pass: (condition: Code, failAction?: () => void) => void;method reset
reset: () => void;method result
result: ( condition: Code, successAction?: () => void, failAction?: () => void) => void;method setParams
setParams: (obj: KeywordCxtParams, assign?: true) => void;method subschema
subschema: (appl: SubschemaArgs, valid: Name) => SchemaCxt;class MissingRefError
class MissingRefError extends Error {}constructor
constructor(resolver: UriResolver, baseId: string, ref: string, msg?: string);property missingRef
readonly missingRef: string;property missingSchema
readonly missingSchema: string;class Name
class Name extends _CodeOrName {}constructor
constructor(s: string);property names
readonly names: UsedNames;property str
readonly str: string;method emptyStr
emptyStr: () => boolean;method toString
toString: () => string;class ValidationError
class ValidationError extends Error {}constructor
constructor( errors: Partial<ErrorObject<string, Record<string, any>, unknown>>[]);property ajv
readonly ajv: boolean;property errors
readonly errors: Partial<ErrorObject<string, Record<string, any>, unknown>>[];property validation
readonly validation: boolean;Interfaces
interface AsyncFormatDefinition
interface AsyncFormatDefinition<T extends string | number> {}interface AsyncSchema
interface AsyncSchema extends _SchemaObject {}property $async
$async: true;interface AsyncValidateFunction
interface AsyncValidateFunction<T = unknown> extends ValidateFunction<T> {}property $async
$async: true;call signature
(...args: Parameters<ValidateFunction<T>>): Promise<T>;interface CodeGenOptions
interface CodeGenOptions {}property es5
es5?: boolean;property lines
lines?: boolean;property ownProperties
ownProperties?: boolean;interface CodeKeywordDefinition
interface CodeKeywordDefinition extends _KeywordDef {}property code
code: (cxt: KeywordCxt, ruleType?: string) => void;property trackErrors
trackErrors?: boolean;interface CodeOptions
interface CodeOptions {}interface ErrorObject
interface ErrorObject< K extends string = string, P = Record<string, any>, S = unknown> {}property data
data?: unknown;property instancePath
instancePath: string;property keyword
keyword: K;property message
message?: string;property params
params: P;property parentSchema
parentSchema?: AnySchemaObject;property propertyName
propertyName?: string;property schema
schema?: S;property schemaPath
schemaPath: string;interface ErrorsTextOptions
interface ErrorsTextOptions {}interface FormatDefinition
interface FormatDefinition<T extends string | number> {}interface FuncKeywordDefinition
interface FuncKeywordDefinition extends _KeywordDef {}interface KeywordErrorDefinition
interface KeywordErrorDefinition {}interface Logger
interface Logger {}interface MacroKeywordDefinition
interface MacroKeywordDefinition extends FuncKeywordDefinition {}property macro
macro: MacroKeywordFunc;interface Plugin
interface Plugin<Opts> {}call signature
(ajv: Ajv, options?: Opts): Ajv;index signature
[prop: string]: any;interface SchemaCxt
interface SchemaCxt {}property allErrors
readonly allErrors?: boolean;property baseId
baseId: string;property compositeRule
readonly compositeRule?: boolean;property createErrors
readonly createErrors?: boolean;property data
readonly data: Name;property dataLevel
readonly dataLevel: number;property dataNames
readonly dataNames: Name[];property dataPathArr
readonly dataPathArr: (Code | number)[];property dataTypes
dataTypes: JSONType[];property definedProperties
definedProperties: Set<string>;property errorPath
readonly errorPath: Code;property errSchemaPath
readonly errSchemaPath: string;property evaluated
evaluated?: Name;property gen
readonly gen: CodeGen;property items
items?: EvaluatedItems | Name;property jtdDiscriminator
jtdDiscriminator?: string;property jtdMetadata
jtdMetadata?: boolean;property opts
readonly opts: InstanceOptions;property parentData
readonly parentData: Name;property parentDataProperty
readonly parentDataProperty: Code | number;property propertyName
readonly propertyName?: Name;property props
props?: EvaluatedProperties | Name;property rootId
readonly rootId: string;property schema
readonly schema: AnySchema;property schemaEnv
readonly schemaEnv: SchemaEnv;property schemaPath
readonly schemaPath: Code;property self
readonly self: Ajv;property topSchemaRef
readonly topSchemaRef: Code;property validateName
readonly validateName: Name;property ValidationError
readonly ValidationError?: Name;interface SchemaObjCxt
interface SchemaObjCxt extends SchemaCxt {}property schema
readonly schema: AnySchemaObject;interface SchemaObject
interface SchemaObject extends _SchemaObject {}property $async
$async?: false;property $id
$id?: string;property $schema
$schema?: string;property id
id?: string;index signature
[x: string]: any;interface SchemaValidateFunction
interface SchemaValidateFunction {}property errors
errors?: Partial<ErrorObject>[];call signature
( schema: any, data: any, parentSchema?: AnySchemaObject, dataCxt?: DataValidationCxt): boolean | Promise<any>;interface ValidateFunction
interface ValidateFunction<T = unknown> {}Type Aliases
type AnySchema
type AnySchema = Schema | AsyncSchema;type AnySchemaObject
type AnySchemaObject = SchemaObject | AsyncSchema;type Code
type Code = _Code | Name;type DefinedError
type DefinedError = | TypeError | ApplicatorKeywordError | ValidationKeywordError | FormatError | UnevaluatedPropertiesError | UnevaluatedItemsError | DependentRequiredError | DiscriminatorError;type ErrorNoParams
type ErrorNoParams<K extends string, S = unknown> = ErrorObject< K, Record<string, never>, S>;type Format
type Format = AddedFormat | string;type InstanceOptions
type InstanceOptions = Options & RequiredInstanceOptions;type JSONSchemaType
type JSONSchemaType<T> = StrictNullChecksWrapper< 'JSONSchemaType', UncheckedJSONSchemaType<T, false>>;type JSONType
type JSONType = (typeof _jsonTypes)[number];type KeywordDefinition
type KeywordDefinition = | CodeKeywordDefinition | FuncKeywordDefinition | MacroKeywordDefinition;type Options
type Options = CurrentOptions & DeprecatedOptions;type Schema
type Schema = SchemaObject | boolean;type Vocabulary
type Vocabulary = (KeywordDefinition | string)[];Package Files (12)
- dist/ajv.d.ts
- dist/compile/codegen/code.d.ts
- dist/compile/codegen/index.d.ts
- dist/compile/index.d.ts
- dist/compile/ref_error.d.ts
- dist/compile/rules.d.ts
- dist/compile/validate/index.d.ts
- dist/core.d.ts
- dist/runtime/validation_error.d.ts
- dist/types/index.d.ts
- dist/types/json-schema.d.ts
- dist/vocabularies/errors.d.ts
Dependencies (4)
Dev Dependencies (41)
- @ajv-validator/config
- @rollup/plugin-commonjs
- @rollup/plugin-json
- @rollup/plugin-node-resolve
- @rollup/plugin-typescript
- @types/chai
- @types/mocha
- @types/node
- @types/require-from-string
- @typescript-eslint/eslint-plugin
- @typescript-eslint/parser
- ajv-formats
- browserify
- chai
- cross-env
- dayjs
- dayjs-plugin-utc
- eslint
- eslint-config-prettier
- glob
- husky
- if-node-version
- jimp
- js-beautify
- json-schema-test
- karma
- karma-chrome-launcher
- karma-mocha
- lint-staged
- mocha
- module-from-string
- node-fetch
- nyc
- prettier
- re2
- rollup
- rollup-plugin-terser
- ts-node
- tsify
- typescript
- uri-js
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/ajv.
- Markdown[](https://www.jsdocs.io/package/ajv)
- HTML<a href="https://www.jsdocs.io/package/ajv"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 7070 ms. - Missing or incorrect documentation? Open an issue for this package.
