kobin icon indicating copy to clipboard operation
kobin copied to clipboard

Type Hints for query parameters.

Open c-bata opened this issue 8 years ago • 0 comments

Summary

I want to exploit type hints for converting query parameters.

Description

IDEA 1

from kobin import Kobin, Response, Param

app = Kobin()

@app.route('/tasks/{task_id}')
def index(task_id: int, query_done: Param[bool]) -> Response:
    return Response('Hello World')

IDEA 2

from kobin import Kobin, Response, query_param

app = Kobin()

@app.route('/tasks/{task_id}')
@query_param('query_done')
def index(task_id: int, query_done: bool) -> Response:
    return Response('Hello World')

c-bata avatar Dec 31 '16 13:12 c-bata