0
votes

I am using Swagger and AWS API Gateway to generate the API for my project,

What I done:

  • In Swagger: I defined paths:

    paths:
        /v1/shop/list/{petID}:
        ...
        /v2/shop/list/{petID}:
        ...
    

    I skipped the basePath, and double checked yaml file in Swagger Editor. All is fine and corrected. I also call the API locally, it works fine.

  • In AWS API Gateway, I create one API, and upload the Swagger yaml using Swagger Hub. Then I deploy API to a stage, let's say "dev"

What problem: I open the API url which generated by AWS API Gateway

https://xxxxxxxxxxx.execute-api.eu-west-1.amazonaws.com/dev/v1/shop/list/1

https://xxxxxxxxxxx.execute-api.eu-west-1.amazonaws.com/dev/v2/shop/list/1

I received the error:

Cannot GET /v1/v1/shop/list/1

Cannot GET /v1/v2/shop/list/1

How come is "/v1/" added to the paths ?

Anyone experienced this problem, please help me.

1

1 Answers

0
votes

The problem from Swagger Hub, when uploading Swagger yaml to AWS API Gateway. It automatically generates a the wrong endpoint with "/v1/v1". My solution is simple updating the endpoint with corrected one.