[英]AWS Api Gateway invalid model schema
I am trying to create a model for my api. 我正在尝试为我的API创建模型。 But aws returns 3x invalid model schema error, couldn't figure out the reason: 但是aws返回3倍无效的模型架构错误,无法找出原因:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "EmailInputModel",
"type":"object",
"properties":{
"email":{
"type":"string",
"required":true,
"patternProperties":{
"^((\"[\\w-\\s]+\")|([\\w-]+(?:\\.[\\w-]+)*)|(\"[\\w-\\s]+\")([\\w-]+(?:\\.[\\w-]+)*))(@((?:[\\w-]+\\.)*\\w[\\w-]{0,66})\\.([a-z]{2,6}(?:\\.[a-z]{2})?)$)|(@\\[?((25[0-5]\\.|2[0-4][0-9]\\.|1[0-9]{2}\\.|[0-9]{1,2}\\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\\]?$)/i": {}
}
},
"message":{
"type":"string",
"required":true
},
"sender":{
"type":"string",
"required":true
}
}
} }
Thanks in advance for help and efforts. 在此先感谢您的帮助和努力。
Looks like the usage of required attribute should be fixed. 看起来required属性的用法应该是固定的。 Try below. 请尝试以下。
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "EmailInputModel",
"type": "object",
"properties": {
"email": {
"type": "string",
"patternProperties":{
"^((\"[\\w-\\s]+\")|([\\w-]+(?:\\.[\\w-]+)*)|(\"[\\w-\\s]+\")([\\w-]+(?:\\.[\\w-]+)*))(@((?:[\\w-]+\\.)*\\w[\\w-]{0,66})\\.([a-z]{2,6}(?:\\.[a-z]{2})?)$)|(@\\[?((25[0-5]\\.|2[0-4][0-9]\\.|1[0-9]{2}\\.|[0-9]{1,2}\\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\\]?$)/i": {}
}
},
"message": {
"type": "string"
},
"sender": {
"type": "string"
}
},
"required": ["email", "message", "sender"]
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.