{"action":"created","issue":{"url":"https://api.github.com/repos/timothycrosley/hug/issues/218","repository_url":"https://api.github.com/repos/timothycrosley/hug","labels_url":"https://api.github.com/repos/timothycrosley/hug/issues/218/labels{/name}","comments_url":"https://api.github.com/repos/timothycrosley/hug/issues/218/comments","events_url":"https://api.github.com/repos/timothycrosley/hug/issues/218/events","html_url":"https://github.com/timothycrosley/hug/issues/218","id":136450481,"number":218,"title":"Bug - Documentation creation seems to fail when adding output types to the \"API signature\"","user":{"login":"ErwinHaasnoot","id":1389269,"avatar_url":"https://avatars.githubusercontent.com/u/1389269?v=3","gravatar_id":"","url":"https://api.github.com/users/ErwinHaasnoot","html_url":"https://github.com/ErwinHaasnoot","followers_url":"https://api.github.com/users/ErwinHaasnoot/followers","following_url":"https://api.github.com/users/ErwinHaasnoot/following{/other_user}","gists_url":"https://api.github.com/users/ErwinHaasnoot/gists{/gist_id}","starred_url":"https://api.github.com/users/ErwinHaasnoot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ErwinHaasnoot/subscriptions","organizations_url":"https://api.github.com/users/ErwinHaasnoot/orgs","repos_url":"https://api.github.com/users/ErwinHaasnoot/repos","events_url":"https://api.github.com/users/ErwinHaasnoot/events{/privacy}","received_events_url":"https://api.github.com/users/ErwinHaasnoot/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/timothycrosley/hug/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-02-25T17:13:14Z","updated_at":"2016-02-25T18:49:14Z","closed_at":"2016-02-25T18:46:26Z","body":"Hi again!\r\n\r\nI ran into a bug - or a mistake in the way I think about defining apis. I want to add output types to my API signatures, so I can inform users of my API on what to expect in return from the API call. However, it throws an exception when I try to access the documentation. That the outgoing type is not JSON serializable.\r\n\r\nI suppose the same special sauce that makes input type signatures work should be applied to output types?\r\n\r\nMy API\r\n```\r\nimport hug\r\n\r\n@hug.get('/')\r\ndef stuff() -> hug.types.text\r\n    return \"hello\"\r\n```\r\n\r\nException:\r\n```\r\nTraceback (most recent call last):\r\n  File \"/usr/local/lib/python3.5/dist-packages/tornado/web.py\", line 1422, in _execute\r\n    result = self.prepare()\r\n  File \"/usr/local/lib/python3.5/dist-packages/tornado/web.py\", line 2681, in prepare\r\n    self.fallback(self.request)\r\n  File \"/usr/local/lib/python3.5/dist-packages/tornado/wsgi.py\", line 277, in __call__\r\n    WSGIContainer.environ(request), start_response)\r\n  File \"/usr/local/lib/python3.5/dist-packages/falcon/api.py\", line 182, in __call__\r\n    responder(req, resp, **params)\r\n  File \"/usr/local/lib/python3.5/dist-packages/hug/run.py\", line 103, in handle_404\r\n    response.data = json.dumps(to_return, indent=4, separators=(',', ': ')).encode('utf8')\r\n  File \"/usr/lib/python3.5/json/__init__.py\", line 237, in dumps\r\n    **kw).encode(obj)\r\n  File \"/usr/lib/python3.5/json/encoder.py\", line 201, in encode\r\n    chunks = list(chunks)\r\n  File \"/usr/lib/python3.5/json/encoder.py\", line 429, in _iterencode\r\n    yield from _iterencode_dict(o, _current_indent_level)\r\n  File \"/usr/lib/python3.5/json/encoder.py\", line 403, in _iterencode_dict\r\n    yield from chunks\r\n  File \"/usr/lib/python3.5/json/encoder.py\", line 403, in _iterencode_dict\r\n    yield from chunks\r\n  File \"/usr/lib/python3.5/json/encoder.py\", line 403, in _iterencode_dict\r\n    yield from chunks\r\n  File \"/usr/lib/python3.5/json/encoder.py\", line 403, in _iterencode_dict\r\n    yield from chunks\r\n  File \"/usr/lib/python3.5/json/encoder.py\", line 403, in _iterencode_dict\r\n    yield from chunks\r\n  File \"/usr/lib/python3.5/json/encoder.py\", line 436, in _iterencode\r\n    o = _default(o)\r\n  File \"/usr/lib/python3.5/json/encoder.py\", line 180, in default\r\n    raise TypeError(repr(o) + \" is not JSON serializable\")\r\n```\r\n\r\nThanks again!\r\n\r\nBest,\r\n\r\nErwin\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/timothycrosley/hug/issues/comments/188925663","html_url":"https://github.com/timothycrosley/hug/issues/218#issuecomment-188925663","issue_url":"https://api.github.com/repos/timothycrosley/hug/issues/218","id":188925663,"user":{"login":"ErwinHaasnoot","id":1389269,"avatar_url":"https://avatars.githubusercontent.com/u/1389269?v=3","gravatar_id":"","url":"https://api.github.com/users/ErwinHaasnoot","html_url":"https://github.com/ErwinHaasnoot","followers_url":"https://api.github.com/users/ErwinHaasnoot/followers","following_url":"https://api.github.com/users/ErwinHaasnoot/following{/other_user}","gists_url":"https://api.github.com/users/ErwinHaasnoot/gists{/gist_id}","starred_url":"https://api.github.com/users/ErwinHaasnoot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ErwinHaasnoot/subscriptions","organizations_url":"https://api.github.com/users/ErwinHaasnoot/orgs","repos_url":"https://api.github.com/users/ErwinHaasnoot/repos","events_url":"https://api.github.com/users/ErwinHaasnoot/events{/privacy}","received_events_url":"https://api.github.com/users/ErwinHaasnoot/received_events","type":"User","site_admin":false},"created_at":"2016-02-25T18:49:14Z","updated_at":"2016-02-25T18:49:14Z","body":"Awesome. Thanks for fixing it so quickly!"}}