从 Swagger 导入不包括 basePath

0

【以下的问题经过翻译处理】 当在要导入的Swagger文件中包含basePath属性时,似乎在使用AWS CLI导入时该属性会被忽略,即使添加了参数来添加它。 根据CLI帮助手册,应该是可能的: ''' --parameters (map) A key-value map of context-specific query string parameters specifying the behavior of different API importing operations. The following shows operation-specific parameters and their supported values.

To handle imported basePath, set parameters as basePath=ignore, basePath=prepend or basePath=split. ''' 要处理导入的basePath,请将参数设置为basePath=ignore、basePath=prepend或basePath=split。”

以下是我的CLI输出: ''' $ aws --version aws-cli/1.16.85 Python/2.7.15rc1 Linux/4.15.0-43-generic botocore/1.12.75

$ aws apigateway import-rest-api --parameters basePath=prepend --body 'file:///tmp/swagger.yaml' { "apiKeySource": "HEADER", "version": "2", "name": "PetStore", "createdDate": 1547020100, "endpointConfiguration": { "types": [ "EDGE" ] }, "id": "yy3s9trtfa" } ''' 这是Swagger输入: ''' swagger: "2.0" info: version: "2" title: PetStore schemes:

  • https basePath: /api paths: /: get: consumes: - application/json produces: - text/html responses: '200': headers: Content-Type: type: string x-amazon-apigateway-integration: responses: default: statusCode: '200' responseParameters: method.response.header.Content-Type: '''text/html''' responseTemplates: text/html: <html><body>Welcome to your Pet Store API</body></html> passthroughBehavior: when_no_match requestTemplates: application/json: '{"statusCode": 200}' type: mock '''
profile picture
专家
已提问 5 个月前10 查看次数
1 回答
0

【以下的回答经过翻译处理】 我们的CLI文档中将'basepath'错误命名为camelCased。如果您尝试使用以下命令进行导入:

$ aws apigateway import-rest-api --parameters basepath=prepend --body 'file:///tmp/swagger.yaml'

则导入将按预期工作。 -JT

profile picture
专家
已回答 5 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则