我正在研究API Blueprint中新数据结构语法的可能性,特别是MSON。是否可以附加或指定类似模式(正则表达式)的内容?在这个主题上找不到任何东西。
发布于 2015-08-11 19:08:50
要为您的数据结构提供正则表达式验证,您需要提供一个具有此验证规则的JSON Schema。例如,如下所示:
### View a Questions Detail [GET]
+ Response 200 (application/json)
+ Attributes
+ question: `Favourite programming language?` (string)
+ Schema
{
"properties": {
"question": {
"type": "string",
"pattern": "^Favourite.*$"
}
}
}https://stackoverflow.com/questions/31830896
复制相似问题