如何解决Swagger 2.0-无法解析安全范围定义
我有一个内置了摇摇欲坠的工具的Node应用,一切正常。
现在,我正在尝试为aws api网关导入向导准备我的swagger文件。该向导将使用cognito authorizor中内置的aws。
但是,一旦我在下面的端点的安全性部分中添加了oauth范围,挥霍验证就会给我以下错误,但我似乎无法修复:
“无法解析安全范围定义xxx / etl-session.write”
{
"swagger": "2.0","info": {
"description": "XX API","version": "9.9","title": "XX API"
},"host": "xxxx.execute-api.us-east-1.amazonaws.com","basePath": "/ew-oct","schemes": [
"https"
],"paths": {
"/etl-session/start": {
"post": {
"operationId": "startEtlSession","consumes": [
"application/json"
],"produces": [
"application/json"
],"parameters": [
{
"in": "body","name": "EtlSessionDTO","required": true,"schema": {
"$ref": "#/definitions/EtlSessionDTO"
}
}
],"responses": {
"201": {
"description": "201 response","schema": {
"$ref": "#/definitions/EtlSessionDTO"
}
},"401": {
"description": "401 response","schema": {
"$ref": "#/definitions/ProblemDetailVM"
}
},"403": {
"description": "403 response","404": {
"description": "404 response","500": {
"description": "500 response","schema": {
"$ref": "#/definitions/ProblemDetailVM"
}
}
},"security": [
{
"cognito-authorizor": [
"xxx/etl-session.write"
]
}
],"x-amazon-apigateway-request-validator": "Validate body,query string parameters,and headers","x-amazon-apigateway-integration": {
"uri": "https://xxxx/api/v1/etl-session/start","responses": {
"default": {
"statusCode": "200"
}
},"passthroughBehavior": "when_no_match","httpMethod": "POST","type": "http"
}
}
},"/health": {
"get": {
"operationId": "getHealth","responses": {
"200": {
"description": "200 response"
},"401": {
"description": "401 response"
},"403": {
"description": "403 response"
},"404": {
"description": "404 response"
},"500": {
"description": "500 response"
}
},"x-amazon-apigateway-integration": {
"uri": "https://xxxx/api/v1/health","httpMethod": "GET","type": "http"
}
}
}
},"securityDefinitions": {
"cognito-authorizor": {
"type": "apiKey","name": "Authorization","in": "header","x-amazon-apigateway-authtype": "cognito_user_pools","x-amazon-apigateway-authorizer": {
"providerARNs": [
"arn:aws:cognito-idp:us-east-1:xxxx:userpool/us-east-xxxxx"
],"type": "cognito_user_pools"
}
}
},"definitions": {
"ProblemDetailVM": {
"type": "object","required": [
"status","title","type"
],"properties": {
"type": {
"type": "string","description": "a URL to a document describing the error condition"
},"title": {
"type": "string","description": "A short,human-readable title for the general error type; the title should not change for given types"
},"status": {
"type": "number","description": "Conveying the HTTP status code; this is so that all information is in one place,but also to correct for changes in the status code due to the usage of proxy servers. The status member,if present,is only advisory as generators MUST use the same status code in the actual HTTP response to assure that generic HTTP software that does not understand this format still behaves correctly"
}
},"title": "ProblemDetailVM","description": "Encapsulates a https://tools.ietf.org/html/rfc7807 style error response"
},"EtlSessionDTO": {
"type": "object","required": [
"source"
],"properties": {
"source": {
"type": "string","enum": [
"URBAN_OR_RURAL"
]
}
},"title": "EtlSessionDTO"
}
},"x-amazon-apigateway-request-validators": {
"Validate body,and headers": {
"validateRequestParameters": true,"validateRequestBody": true
}
}
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。