{"action":"created","issue":{"url":"https://api.github.com/repos/checkmate/simpl/issues/66","labels_url":"https://api.github.com/repos/checkmate/simpl/issues/66/labels{/name}","comments_url":"https://api.github.com/repos/checkmate/simpl/issues/66/comments","events_url":"https://api.github.com/repos/checkmate/simpl/issues/66/events","html_url":"https://github.com/checkmate/simpl/pull/66","id":94927309,"number":66,"title":"(WIP) PoC for request schema validation deco","user":{"login":"larsbutler","id":464394,"avatar_url":"https://avatars.githubusercontent.com/u/464394?v=3","gravatar_id":"","url":"https://api.github.com/users/larsbutler","html_url":"https://github.com/larsbutler","followers_url":"https://api.github.com/users/larsbutler/followers","following_url":"https://api.github.com/users/larsbutler/following{/other_user}","gists_url":"https://api.github.com/users/larsbutler/gists{/gist_id}","starred_url":"https://api.github.com/users/larsbutler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/larsbutler/subscriptions","organizations_url":"https://api.github.com/users/larsbutler/orgs","repos_url":"https://api.github.com/users/larsbutler/repos","events_url":"https://api.github.com/users/larsbutler/events{/privacy}","received_events_url":"https://api.github.com/users/larsbutler/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/checkmate/simpl/labels/in%20progress","name":"in progress","color":"ededed"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-07-14T11:40:37Z","updated_at":"2015-07-14T12:51:33Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/checkmate/simpl/pulls/66","html_url":"https://github.com/checkmate/simpl/pull/66","diff_url":"https://github.com/checkmate/simpl/pull/66.diff","patch_url":"https://github.com/checkmate/simpl/pull/66.patch"},"body":"It's a work-in-progress.\r\n\r\nHow to use:\r\n\r\n```python\r\nimport bottle\r\n\r\nfrom simpl import rest\r\n\r\nimport voluptuous as volup\r\n\r\n\r\nFOO_QUERY_SCHEMA = volup.Schema({\r\n    'a': rest.Many(int),\r\n    'b': rest.One(str),\r\n})\r\n\r\n\r\n@bottle.route('/foo')\r\n@rest.schema(query_schema=FOO_QUERY_SCHEMA)\r\ndef foo(body):\r\n    return body\r\n\r\n\r\ndef start():\r\n    \"\"\"Start a Juno Server.\"\"\"\r\n    app = bottle.default_app()\r\n    bottle.run(app=app, host='0.0.0.0', port=8080)\r\n\r\nif __name__ == '__main__':\r\n    start()\r\n```\r\n\r\nSince some endpoints might want to accept multiple values for a given query parameter, the `One` and `Many` functions allow that to be specified and handled nicely.\r\n\r\nThis is somewhat opinionated for `bottle`, since query params from bottle requests are group into dicts of lists, keyed by the parameter name."},"comment":{"url":"https://api.github.com/repos/checkmate/simpl/issues/comments/121230153","html_url":"https://github.com/checkmate/simpl/pull/66#issuecomment-121230153","issue_url":"https://api.github.com/repos/checkmate/simpl/issues/66","id":121230153,"user":{"login":"larsbutler","id":464394,"avatar_url":"https://avatars.githubusercontent.com/u/464394?v=3","gravatar_id":"","url":"https://api.github.com/users/larsbutler","html_url":"https://github.com/larsbutler","followers_url":"https://api.github.com/users/larsbutler/followers","following_url":"https://api.github.com/users/larsbutler/following{/other_user}","gists_url":"https://api.github.com/users/larsbutler/gists{/gist_id}","starred_url":"https://api.github.com/users/larsbutler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/larsbutler/subscriptions","organizations_url":"https://api.github.com/users/larsbutler/orgs","repos_url":"https://api.github.com/users/larsbutler/repos","events_url":"https://api.github.com/users/larsbutler/events{/privacy}","received_events_url":"https://api.github.com/users/larsbutler/received_events","type":"User","site_admin":false},"created_at":"2015-07-14T12:51:33Z","updated_at":"2015-07-14T12:51:33Z","body":"In case it wasn't clear, I've still got a lot of docs and tests to add, so please don't merge anything yet."}}