openwhisk-apigateway icon indicating copy to clipboard operation
openwhisk-apigateway copied to clipboard

Api v2 management allows swagger config to have basepath and path both set to /

Open csantanapr opened this issue 7 years ago • 7 comments

When creating a new api, a swagger is sent to api management with both base path and operation path set to / the API doesn't error out.

To reproduce you should could use the WSK CLI

wsk api create / / get myaction
wsk api list -f
Action: /guest/myaction
  API Name: /
  Base path: /
  Path: /
  Verb: get
  URL: https://service.eu.apiconnect.ibmcloud.com/gws/apigateway/api/123/

api management doesn't return error to know that there is an invalid combination to have both base path and operation path set to /

csantanapr avatar Aug 03 '17 19:08 csantanapr

If an API happens to be created with a basepath and path of / each, subsequent APIs created after this "/" API can be affected -> successful API creation followed by API invocation results in a 404 status code

mdeuser avatar Aug 03 '17 22:08 mdeuser

FWiW, I would like this to work. I can't remember the last time I created an API that didn't have a root endpoint.

akrabat avatar Aug 04 '17 05:08 akrabat

@akrabat but would you really want an API that has a root endpoint and basically no base path?

mhamann avatar Aug 04 '17 15:08 mhamann

To be honest I have no idea what the base path is and how it differs from the api path.

I do want to be able to do curl https://my-cnamed-domain.com/ and get back a response. I expect that this API needs to be in it's own namespace for this to work though.

akrabat avatar Aug 04 '17 16:08 akrabat

I can see how a URL like "https://my-cnamed-domain.com/" invokes a web action like "public/index" that receive a __ow-path with "/" returns the html content for a website

csantanapr avatar Aug 05 '17 14:08 csantanapr

I can see how a URL like "https://my-cnamed-domain.com/" invokes a web action like "public/index" that receive a __ow-path with "/" returns the html content for a website

Yes. For APIs, I was thinking along the lines of the Home Documents for HTTP APIs proposal.

akrabat avatar Aug 05 '17 15:08 akrabat

When it comes to the typical REST API, I don't know how often this scenario occurs. The HTML use case is the most compelling, given that you typically want a home document.

Obviously, this is a use case for Whisk itself, but is it one for the API gateway? Would someone typically front an HTML page with the gateway?

mhamann avatar Aug 09 '17 03:08 mhamann