Importing not including the basePath from Swagger

0

When including a basePath attribute to the swagger file to be imported, seems that it just gets ignored when import using the AWS CLI, even though I've adding the parameter to prepend it.

According to the CLI help manual, it should be possible:

--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.

Here's my cli output:

$ 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"
}

And here's the swagger input:

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
klob
已提問 5 年前檢視次數 464 次
2 個答案
0
已接受的答案

Our CLI documentation has 'basepath' incorrectly camelCased. If you try:

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

the import will work as you expect.

-JT

AWS
JT
已回答 5 年前
0

Ah well, wasn't that a stupid thing. Thanks JT for pointing that out!

klob
已回答 5 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南