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
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年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ