zalando-stups / api-first-hand-service

API-First-Hand activator template
Other
10 stars 5 forks source link

Why does basePath must match the yaml file name? #9

Closed oswaldo closed 8 years ago

oswaldo commented 8 years ago

I've done a couple of experiments and noticed that if the basePath doesn't match the yaml file name, I would get a 404 with the requested path as the response body and no other error message to tell me what happened.

As some swagger examples (on swagger's site) show v1 as a basePath, possibly people that follow this approach will trip over the same difficulty.

I confirmed it by creating a simple file based on the example.yaml leaving only the getUserTodos. If you don't set the basePath to /example2, instead of the expected code from the default NotImplementedYet, you should get a 404.

The same is true if you change the basePath to /example2/v1.

I believe that if this is an intentional limitation, it should be documented in the README.md. If not intentional, it is a bug.

The workaround is instead of having a basePath /example2/v1 and a path /todos/{user_id}, having the basePath /example2 and every path prefixed like /v1/todos/{user_id} (which really makes me feel it is a bug as the editor page gets rendered for both, having the operation to point to /example2/v1/todos/{user_id} in both cases)

(opened the same ticket in https://github.com/zalando/play-swagger/issues/177 as it is related to the library itself and not only to the tutorial. the ticket here should be closed)

slavaschmidt commented 8 years ago

Closing as duplicate of zalando/play-swagger#177