inaka / cowboy_swagger

Swagger integration for Cowboy (built on trails)

Home Page:http://inaka.net/blog/2015/08/19/cowboy-swagger/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Verify that for each path each cowboy binding has a correspondingly named parameter

lucafavatella opened this issue · comments

E.g. a cowboy binding :id must have a corresponding Swagger parameter named id.

Current behaviour is that such constraint is not enforced hence cowboy_swagger generates /api-docs/swagger.json for UI accessible at /api-docs with path that may contain bindings with no corresponding parameter, hence causing curly variable template to be sent to server.


Example: trail with cowboy binding called :id and swagger parameter named key causes this Swagger UI...

swaggeruiwithkeyratherthanid

... that when clicking Try it out! sends to server something like /places/{id} - i.e. with no replaced value:

2017-03-09 13:15:16.503 [info] <0.942.0> PUT /places/%7Bid%7D

Tentatively assigning this to myself. Can't guarantee I'll look at it in the near future, but this way it'll be on my "radar".

I bumped into this today. I want to have a route like /users/:user_id/[queries/:query_id] where the optional part is not acceptable for a PUT operation. The way it is the request is getting sent as /users/<user_id>/queries/{query_id}, since I have no input to fill in.

I bumped into this today. I want to have a route like /users/:user_id/[queries/:query_id] where the optional part is not acceptable for a PUT operation. The way it is the request is getting sent as /users/<user_id>/queries/{query_id}, since I have no input to fill in.

Hm... probably not the same issue, since I can have different trails for different routes. Oh, well...