<img align="right" alt="Ajv logo" width="160" src="http://epoberezkin.github.io/ajv/images/ajv_logo.png">
# Ajv: Another JSON Schema Validator
The fastest JSON Schema validator for Node.js and browser. Supports draft-04/06/07.
[![Build Status](https://travis-ci.org/epoberezkin/ajv.svg?branch=master)](https://travis-ci.org/epoberezkin/ajv)
[![npm](https://img.shields.io/npm/v/ajv.svg)](https://www.npmjs.com/package/ajv)
[![npm downloads](https://img.shields.io/npm/dm/ajv.svg)](https://www.npmjs.com/package/ajv)
[![Coverage Status](https://coveralls.io/repos/epoberezkin/ajv/badge.svg?branch=master&service=github)](https://coveralls.io/github/epoberezkin/ajv?branch=master)
[![Greenkeeper badge](https://badges.greenkeeper.io/epoberezkin/ajv.svg)](https://greenkeeper.io/)
[![Gitter](https://img.shields.io/gitter/room/ajv-validator/ajv.svg)](https://gitter.im/ajv-validator/ajv)
## Using version 6
[JSON Schema draft-07](http://json-schema.org/latest/json-schema-validation.html) is published.
[Ajv version 6.0.0](https://github.com/epoberezkin/ajv/releases/tag/v6.0.0) that supports draft-07 is released. It may require either migrating your schemas or updating your code (to continue using draft-04 and v5 schemas, draft-06 schemas will be supported without changes).
__Please note__: To use Ajv with draft-06 schemas you need to explicitly add the meta-schema to the validator instance:
```javascript
ajv.addMetaSchema(require('ajv/lib/refs/json-schema-draft-06.json'));
```
To use Ajv with draft-04 schemas in addition to explicitly adding meta-schema you also need to use option schemaId:
```javascript
var ajv = new Ajv({schemaId: 'id'});
// If you want to use both draft-04 and draft-06/07 schemas:
// var ajv = new Ajv({schemaId: 'auto'});
ajv.addMetaSchema(require('ajv/lib/refs/json-schema-draft-04.json'));
```
## Contents
- [Performance](#performance)
- [Features](#features)
- [Getting started](#getting-started)
- [Frequently Asked Questions](https://github.com/epoberezkin/ajv/blob/master/FAQ.md)
- [Using in browser](#using-in-browser)
- [Command line interface](#command-line-interface)
- Validation
- [Keywords](#validation-keywords)
- [Annotation keywords](#annotation-keywords)
- [Formats](#formats)
- [Combining schemas with $ref](#ref)
- [$data reference](#data-reference)
- NEW: [$merge and $patch keywords](#merge-and-patch-keywords)
- [Defining custom keywords](#defining-custom-keywords)
- [Asynchronous schema compilation](#asynchronous-schema-compilation)
- [Asynchronous validation](#asynchronous-validation)
- [Security considerations](#security-considerations)
- [Security contact](#security-contact)
- [Untrusted schemas](#untrusted-schemas)
- [Circular references in objects](#circular-references-in-javascript-objects)
- [Trusted schemas](#security-risks-of-trusted-schemas)
- Modifying data during validation
- [Filtering data](#filtering-data)
- [Assigning defaults](#assigning-defaults)
- [Coercing data types](#coercing-data-types)
- API
- [Methods](#api)
- [Options](#options)
- [Validation errors](#validation-errors)
- [Plugins](#plugins)
- [Related packages](#related-packages)
- [Some packages using Ajv](#some-packages-using-ajv)
- [Tests, Contributing, History, Support, License](#tests)
## Performance
Ajv generates code using [doT templates](https://github.com/olado/doT) to turn JSON Schemas into super-fast validation functions that are efficient for v8 optimization.
Currently Ajv is the fastest and the most standard compliant validator according to these benchmarks:
- [json-schema-benchmark](https://github.com/ebdrup/json-schema-benchmark) - 50% faster than the second place
- [jsck benchmark](https://github.com/pandastrike/jsck#benchmarks) - 20-190% faster
- [z-schema benchmark](https://rawgit.com/zaggino/z-schema/master/benchmark/results.html)
- [themis benchmark](https://cdn.rawgit.com/playlyfe/themis/master/benchmark/results.html)
Performance of different validators by [json-schema-benchmark](https://github.com/ebdrup/json-schema-benchmark):
[![performance](https://chart.googleapis.com/chart?chxt=x,y&cht=bhs&chco=76A4FB&chls=2.0&chbh=32,4,1&chs=600x416&chxl=-1:|djv|ajv|json-schema-validator-generator|jsen|is-my-json-valid|themis|z-schema|jsck|skeemas|json-schema-library|tv4&chd=t:100,98,72.1,66.8,50.1,15.1,6.1,3.8,1.2,0.7,0.2)](https://github.com/ebdrup/json-schema-benchmark/blob/master/README.md#performance)
## Features
- Ajv implements full JSON Schema [draft-06/07](http://json-schema.org/) and draft-04 standards:
- all validation keywords (see [JSON Schema validation keywords](https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md))
- full support of remote refs (remote schemas have to be added with `addSchema` or compiled to be available)
- support of circular references between schemas
- correct string lengths for strings with unicode pairs (can be turned off)
- [formats](#formats) defined by JSON Schema draft-07 standard and custom formats (can be turned off)
- [validates schemas against meta-schema](#api-validateschema)
- supports [browsers](#using-in-browser) and Node.js 0.10-8.x
- [asynchronous loading](#asynchronous-schema-compilation) of referenced schemas during compilation
- "All errors" validation mode with [option allErrors](#options)
- [error messages with parameters](#validation-errors) describing error reasons to allow creating custom error messages
- i18n error messages support with [ajv-i18n](https://github.com/epoberezkin/ajv-i18n) package
- [filtering data](#filtering-data) from additional properties
- [assigning defaults](#assigning-defaults) to missing properties and items
- [coercing data](#coercing-data-types) to the types specified in `type` keywords
- [custom keywords](#defining-custom-keywords)
- draft-06/07 keywords `const`, `contains`, `propertyNames` and `if/then/else`
- draft-06 boolean schemas (`true`/`false` as a schema to always pass/fail).
- keywords `switch`, `patternRequired`, `formatMaximum` / `formatMinimum` and `formatExclusiveMaximum` / `formatExclusiveMinimum` from [JSON Schema extension proposals](https://github.com/json-schema/json-schema/wiki/v5-Proposals) with [ajv-keywords](https://github.com/epoberezkin/ajv-keywords) package
- [$data reference](#data-reference) to use values from the validated data as values for the schema keywords
- [asynchronous validation](#asynchronous-validation) of custom formats and keywords
Currently Ajv is the only validator that passes all the tests from [JSON Schema Test Suite](https://github.com/json-schema/JSON-Schema-Test-Suite) (according to [json-schema-benchmark](https://github.com/ebdrup/json-schema-benchmark), apart from the test that requires that `1.0` is not an integer that is impossible to satisfy in JavaScript).
## Install
```
npm install ajv
```
## <a name="usage"></a>Getting started
Try it in the Node.js REPL: https://tonicdev.com/npm/ajv
The fastest validation call:
```javascript
var Ajv = require('ajv');
var ajv = new Ajv(); // options can be passed, e.g. {allErrors: true}
var validate = ajv.compile(schema);
var valid = validate(data);
if (!valid) console.log(validate.errors);
```
or with less code
```javascript
// ...
var valid = ajv.validate(schema, data);
if (!valid) console.log(ajv.errors);
// ...
```
or
```javascript
// ...
var valid = ajv.addSchema(schema, 'mySchema')
.validate('mySchema', data);
if (!valid) console.log(ajv.errorsText());
// ...
```
See [API](#api) and [Options](#options) for more details.
Ajv compiles schemas to functions and caches them in all cases (using schema serialized with [fast-json-stable-stringify](https://github.com/epoberezkin/fast-json-stable-stringify) or a custom function as a key), so that the next time the same schema is used (not necessarily the same ob
没有合适的资源?快使用搜索试试~ 我知道了~
YYC松鼠聚合直播系统融和电商商城、网红热点、娱乐竞技直播等 v3.0.2.zip
共2005个文件
js:966个
php:297个
json:165个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 198 浏览量
2024-01-18
09:37:48
上传
评论 1
收藏 27.39MB ZIP 举报
温馨提示
松鼠聚合直播系统自2019年开发,松鼠聚合直播系统是一套团队自主研发、源码开源,可自由二次开发的直播系统。系统融和电商商城、网红热点、娱乐竞技直播等,能够快速实现吸粉引流,集合在线直播、互动分享、社交传播等一体化功能,实现“直播+”的效果最大化运营需求。 关于接口 支持定制直播APP,直播网站的接口,详情可联系客服 近期更新日志 2022年10月28日松鼠聚合直播系统v3.0.2更新 更新日志 ·修复上传视频路径不正确导致前台视频模块不正常 2022年10月25日松鼠聚合直播系统v3.0.2更新 更新日志 ·修复第三方库导致后台打包后网络错误 2022年5月13日松鼠聚合直播系统进行v3更新,本次为v3.0.1更新 更新日志 ·加密通信 ·优化注册登录机制 ·其他筹备工作 2020年4月更新松鼠聚合直播系统2.0版本 1、支持定制各类直播接口数据,大型游戏,体育,娱乐直播等需要得到其官方授权许可,非法改动接口后果一切自负 。 2、支持短视频发布,短视频观看支持全屏。 3、支持直播内页广告位,banner广告位,文字广告。 4、支持点卡系统,后台可配
资源推荐
资源详情
资源评论
收起资源包目录
YYC松鼠聚合直播系统融和电商商城、网红热点、娱乐竞技直播等 v3.0.2.zip (2005个子文件)
address 692B
.babelrc 230B
test.bmp 0B
calendar 998B
card 2KB
jsl.node.conf 7KB
jsl.node.conf 7KB
app.2d4403c1dd20734d6bd5063c0068ff2f.css 81KB
index.css 68KB
view.css 56KB
view.css 55KB
index.css 14KB
qunit.css 3KB
errors.def 8KB
definitions.def 4KB
coerce.def 2KB
defaults.def 1KB
missing.def 1KB
Migration.template.php.dist 755B
Seed.template.php.dist 325B
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.editorconfig 429B
.editorconfig 306B
.editorconfig 147B
.eslintignore 6B
.eslintrc 573B
.eslintrc 414B
.eslintrc 363B
hiddeninput.exe 9KB
geo 173B
test.gif 233KB
.gitignore 154B
.gitignore 51B
.gitignore 43B
.gitignore 43B
.gitignore 42B
.gitignore 39B
.gitignore 29B
.gitignore 29B
.gitignore 28B
.gitignore 16B
.gitignore 14B
.gitignore 14B
.gitignore 13B
.gitignore 7B
.gitkeep 0B
.gitmodules 89B
.gitmodules 0B
.htaccess 224B
.htaccess 13B
.htaccess 13B
index.html 4KB
intersection-observer-test.html 2KB
__uniappview.html 811B
__uniappview.html 811B
test-es5-min.html 632B
test-es5.html 628B
index.html 613B
index.html 378B
example.html 211B
hyper-schema 1KB
hyper-schema 1KB
hyper-schema 1KB
hyper-schema 1002B
hyper-schema 996B
songshuliveadmin.iml 1KB
safeAreaInsets.iml 469B
info 299B
lcov.info 0B
interfaces 868B
3.jpg 31KB
6.jpg 31KB
1.jpg 30KB
7.jpg 30KB
8.jpg 29KB
2.jpg 29KB
4.jpg 28KB
5.jpg 27KB
test.jpg 9KB
NodePlayer-full.min.js 2.52MB
NodePlayer.min.js 1.98MB
NodePlayer-only264.min.js 1.65MB
vendor.js 969KB
app-view.js 819KB
app-service.js 767KB
view.umd.min.js 384KB
view.umd.min.js 366KB
index.umd.min.js 354KB
vue.js 345KB
vendor.320ce225491048333a2d.js 331KB
vue.esm.js 330KB
vue.common.dev.js 324KB
vue.esm.browser.js 319KB
ajv.bundle.js 272KB
vue.runtime.js 241KB
vue.runtime.esm.js 230KB
共 2005 条
- 1
- 2
- 3
- 4
- 5
- 6
- 21
资源评论
智慧浩海
- 粉丝: 1w+
- 资源: 5445
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- bdwptqmxgj11.zip
- onnxruntime-win-x86
- onnxruntime-win-x64-gpu-1.20.1.zip
- vs2019 c++20 语法规范 头文件 <ratio> 的源码阅读与注释,处理分数的存储,加减乘除,以及大小比较等运算
- 首次尝试使用 Win,DirectX C++ 中的形状渲染套件.zip
- 预乘混合模式是一种用途广泛的三合一混合模式 它已经存在很长时间了,但似乎每隔几年就会被重新发现 该项目包括使用预乘 alpha 的描述,示例和工具 .zip
- 项目描述 DirectX 引擎支持版本 9、10、11 库 Microsoft SDK 功能相机视图、照明、加载网格、动画、蒙皮、层次结构界面、动画控制器、网格容器、碰撞系统 .zip
- 项目 wiki 文档中使用的代码教程的源代码库.zip
- 面向对象的通用GUI框架.zip
- 基于Java语言的PlayerBase游戏角色设计源码
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功