hapic icon indicating copy to clipboard operation
hapic copied to clipboard

Support multiple route for one controller (Flask, Pyramid)

Open inkhey opened this issue 7 years ago • 0 comments

At present:

Only one route (method, url) per controller is handled correctly : no documentation generation for others valids routes.

In Bottle, that has no consequence because you need to explicitly create one controller for each route :

app.route('/hello/<name>', callback=self.hello2, method='POST')

In Flask, only the route corresponding to the 'first' method is handled correctly in hapic, multiples value in methods params isn't handled correctly:

 app.add_url_rule('/hello/<name>', "hello2", self.hello2, methods=['POST', ])

so documentation for :

 app.add_url_rule('/hello/<name>', "hello2", self.hello2, methods=['POST','GET' ])

will be incomplete.

In Pyramid, only the first route linked to a view is handled correctly in hapic.

configurator.add_route('hello2', '/hello/{name}', request_method='POST') 
configurator.add_view(self.hello2, route_name='hello2', renderer='json') 

so documentation for :

configurator.add_route('hello2', '/hello/{name}', request_method='GET') 
configurator.add_route('hello2', '/hello/{name}', request_method='POST') 
configurator.add_view(self.hello2, route_name='hello2', renderer='json') 

will be incomplete.

Expected:

Be able to support multiple route for one controllers according to context, Find_route method for each context should return multiple route instead of only one.

inkhey avatar Dec 14 '17 16:12 inkhey