问题描述
我将 OpenAPI 定义 json 导入 AWS API Gateway,但我注意到路径或查询参数验证均无效。我希望做 /card/{type}?userId={userId}
,其中类型属于一组枚举值和具有正则表达式模式的 userId,如下所示:
"paths: {
"/card/{type}": {
"get": {
"operationId": "..","parameters": [
{
"name": "type","in": "path","schema": {"$ref": "#/components/schemas/type}
},{
"name": "userId"
"in": "query","schema": {
"type": "string","pattern": "<some regex>"
}
},...
]
}
}
}
事实证明我可以为路径和查询参数输入任何我想要的值。所以我尝试从 AWS 控制台导出 OpenAPI 文件,我得到:
...
"parameters": [
{
"name": "type","schema": {
"type": "string"
}
},"schema": {
"type": "string"
}
对于 API Gateway,验证器是否不适用于 URL 的哪一部分?因为带有 body 的请求似乎工作正常。还是我遗漏了什么?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)