node.js - Ajv:错误:严格模式:未知关键字:“$schema”
问题描述
使用 ajv v8.6.3 nodejs 和 typescript
试图解析 JSON 但是我得到了这个Error: strict mode: unknown keyword: "$schema"
有人对此有所了解吗?
export const mySchema ={
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
"names": {
"items": {
"type": "number"
},
"type": "array"
}
},
"type": "object"
}
const ajv = new Ajv()
ajv.addMetaSchema(draft7MetaSchema)
ajv.compileParser(mySchema)
解决方案
推荐阅读
- highcharts - Highcharts - 将两个单独的条形图链接在一起
- jquery - 如何从回调函数范围外获取变量数据?
- javascript - JSColor onChange 事件说函数未定义
- python - 选择后重新启动代码不在“选择”变量中?
- mysql - MySQL: GROUP BY + HAVING MAX(...) --- 为什么 HAVING MAX(grade) 不会返回最高等级?
- javascript - 浏览器大小更改时 HTML 网站重新加载
- node.js - 运行 npm install run 时出错
- javascript - Keydown 事件未按预期工作。图像静止不动?
- filter - 当带有过滤器选项的 ForEach 在 Swiftui 中没有显示结果时,如何显示文本?
- google-apps-script - 如何获取将 Google 联系人导入 Google 表格的脚本?