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 Risposte
0
Risposta accettata

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
con risposta 5 anni fa
0

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

klob
con risposta 5 anni fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande