当前位置:网站首页>Hello JSON Schema
Hello JSON Schema
2022-07-17 14:26:00 【王老急888】
定义一个JSON接口,如何准确的描述它?
JSON schema可能是个好的方式。
https://json-schema.org/understanding-json-schema/reference/array.html
{
"type": "array",
"minItems": 4,
"maxItems": 4,
"items": {
"type": "integer",
"minimum": 0,
"maximum": 255
}
}
在线验证
https://www.jsonschemavalidator.net/
Ajv
https://ajv.js.org/guide/getting-started.html
yarn add ajv
Example
import Ajv from 'ajv';
const schema = {
type: 'array', minItems: 4, maxItems: 4, items: {
type: 'integer', minimum: 0, maximum: 255 } };
const ajv = new Ajv();
const validate = ajv.compile(schema);
console.log(validate([1, 2, 3, 4]));
边栏推荐
- SSM uses POI to export data to excel
- Accident caused by the combination of annotation transaction + distributed lock at the read committed level -- disorder of activity purchase opportunities
- SAP S4 material management inventory module mard database table reading technical details
- Play with the one-stop scheme of cann target detection and recognition
- STC8H开发(十四): I2C驱动RX8025T高精度实时时钟芯片
- 今日睡眠质量记录79分
- Huawei machine test: Message decompression
- Cmake常用命令(五)
- Powercli script performance optimization
- 设置cmd命令提示符窗口的界面语言为英文
猜你喜欢

A fastandrobust convolutionalneuralnetwork-based defect detection model inproductqualitycontrol-阅读笔记

Getting started with web security - deploy snort open source ids/ips system
![Some methods of early MCU encryption [get data in the comment area]](/img/14/8e1dcb799d8a3c0aefcac09be9dc51.png)
Some methods of early MCU encryption [get data in the comment area]

Mpu9250 ky9250 attitude, angle module and mpu9250 MPL DMA comparison

火箭大机动运动欧拉角解算的探讨

Documents required for military product development process - advanced version

Unity dropdown (editable, inputable) drop-down selection box with Text Association

Today's sleep quality record 79 points

Win10 install Apache Jena 3.17

Unity3d read mpu9250 example source code
随机推荐
A curated list of awesome Qt and QML
Google Earth engine - Hansen global forest change v1.8 (2000-2020) forest coverage and forest loss data set
CodeForces - 587E(线性基+线段树+差分)
Introduction of database lock, shared with InnoDB, exclusive lock
6G smart endogenous: technical challenges, architecture and key features
JVM hook hooks function
The type of MySQL index (single column index, combined index, BTREE index, clustered index, etc.)
UE4 understanding of animation blueprint
SPI service discovery mechanism
E-commerce sales data analysis and prediction (date data statistics, daily statistics, monthly statistics)
Paper notes: mind the gap an empirical evaluation of impaction ofmissing values techniques in timeseries
mpu9250 ky9250姿态、角度模块和mpu9250 mpl dma对比
今日睡眠质量记录79分
Limit query of MySQL optimization series
NVIDIA uses AI to design GPU: the latest H100 has been used, which reduces the chip area by 25% compared with traditional EDA
一个报错, Uncaught TypeError: ModalFactory is not a constructor
Loj#2324-「清华集训 2017」小 Y 和二叉树
Download of common getshell tools
Model comparison of material inventory management between sap ECC and s4hana material
STC8H开发(十四): I2C驱动RX8025T高精度实时时钟芯片