gpt4 book ai didi

apiblueprint - 在 API Blueprint/MSON 中使用模式

转载 作者:行者123 更新时间:2023-12-04 15:10:01 24 4
gpt4 key购买 nike

我正在研究 API Blueprint 中新数据结构语法的可能性,尤其是 MSON。是否可以附加或者更确切地说指定诸如模式(正则表达式)之类的东西?未找到有关此主题的任何内容。

最佳答案

要为您的数据结构提供正则表达式验证,您需要提供具有此验证规则的 JSON 模式。例如,如下所示:

### View a Questions Detail [GET]

+ Response 200 (application/json)
+ Attributes
+ question: `Favourite programming language?` (string)

+ Schema

{
"properties": {
"question": {
"type": "string",
"pattern": "^Favourite.*$"
}
}
}

关于apiblueprint - 在 API Blueprint/MSON 中使用模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31830896/

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