cowboy_swagger icon indicating copy to clipboard operation
cowboy_swagger copied to clipboard

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

Open lucafavatella opened this issue 7 years ago • 3 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

lucafavatella avatar Mar 09 '17 13:03 lucafavatella

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".

paulo-ferraz-oliveira avatar Oct 28 '20 11:10 paulo-ferraz-oliveira

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.

paulo-ferraz-oliveira avatar Jan 19 '21 11:01 paulo-ferraz-oliveira

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...

paulo-ferraz-oliveira avatar Jan 19 '21 11:01 paulo-ferraz-oliveira