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
preguntada hace 5 años464 visualizaciones
2 Respuestas
0
Respuesta aceptada

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
respondido hace 5 años
0

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

klob
respondido hace 5 años

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas