我有以下架构
var schema = {
"$id": "postClientSchema.json",
"type": "object",
"definitions": {},
"$schema": "http://json-schema.org/draft-06/schema#",
"additionalProperties": false,
"dynamicDefaults": {
"Type": "gettype"
},
"properties": {
"ID": {
"type": "integer"
},
"Name": {
"type": "string"
},
"Type": {
"type": "integer"
}
}
}
我希望用从 dynamicDefaults 获得的值覆盖传入有效负载中的 Type 值。gettype
是一个自定义函数,它返回我的type
属性值。
我正在使用 AJV 进行模式验证。谢谢