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년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠