gpt4 book ai didi

node.js - JSON 架构 : date greater than an other

转载 作者:搜寻专家 更新时间:2023-10-31 22:56:25 24 4
gpt4 key购买 nike

我有一个像这样的 json 模式:

{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Operation",
"description": "The schema of an operation",
"type": "object",
"properties": {
"id":{
"description": "Unique identifier of the service",
"type": "string"
},
"description":{
"type": "string"
},
"dateDebut":{
"type": "string",
"format": "date-time"
},
"dateFin":{
"type": "string",
"format": "date-time"
}
}
}

如何在我的架构中说明 dateFin 必须大于 dateDebut

最佳答案

这个库支持 https://github.com/epoberezkin/ajv#features

var ajv = Ajv({v5:true,allErrors: true})

{
"startDate": {
"format": "date",
"message": "Please Enter correct date format YYYY-MM-DD"
},
"endDate": {
"format": "date",
"message": "Please Enter correct date format YYYY-MM-DD",
"formatMinimum": {
"$data": "1/startDate"
}
}
}

关于node.js - JSON 架构 : date greater than an other,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26906193/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com