{"action":"opened","issue":{"url":"https://api.github.com/repos/timothycrosley/hug/issues/657","repository_url":"https://api.github.com/repos/timothycrosley/hug","labels_url":"https://api.github.com/repos/timothycrosley/hug/issues/657/labels{/name}","comments_url":"https://api.github.com/repos/timothycrosley/hug/issues/657/comments","events_url":"https://api.github.com/repos/timothycrosley/hug/issues/657/events","html_url":"https://github.com/timothycrosley/hug/issues/657","id":320472554,"number":657,"title":"Output documentation is wrong for Marshmallow types","user":{"login":"dangitall","id":882363,"avatar_url":"https://avatars2.githubusercontent.com/u/882363?v=4","gravatar_id":"","url":"https://api.github.com/users/dangitall","html_url":"https://github.com/dangitall","followers_url":"https://api.github.com/users/dangitall/followers","following_url":"https://api.github.com/users/dangitall/following{/other_user}","gists_url":"https://api.github.com/users/dangitall/gists{/gist_id}","starred_url":"https://api.github.com/users/dangitall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dangitall/subscriptions","organizations_url":"https://api.github.com/users/dangitall/orgs","repos_url":"https://api.github.com/users/dangitall/repos","events_url":"https://api.github.com/users/dangitall/events{/privacy}","received_events_url":"https://api.github.com/users/dangitall/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-05-05T02:29:41Z","updated_at":"2018-05-05T02:29:41Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"If the output is annotated with a Marshmallow schema it looks like the generated documentation is using the docstring for the `dump` method of the schema, not the schema itself.\r\n\r\nRunning this:\r\n```\r\nimport hug\r\nfrom marshmallow import Schema, fields\r\n\r\n\r\nclass Bar(Schema):\r\n    name = fields.Str()\r\n\r\n\r\nBar.__doc__ = \"Class docs\"\r\nBar.dump.__doc__ = \"Dump docs\"\r\n\r\n\r\n@hug.post()\r\ndef foo() -> Bar():\r\n    pass\r\n\r\n\r\ndef main():\r\n    from pprint import pprint\r\n    pprint(foo.interface.http.documentation())\r\n\r\n\r\nif __name__ == '__main__':\r\n    main()\r\n```\r\n\r\nGenerates this output:\r\n```\r\nOrderedDict([('examples', ['']),\r\n             ('outputs',\r\n              OrderedDict([('format',\r\n                            'JSON (Javascript Serialized Object Notation)'),\r\n                           ('content_type', 'application/json; charset=utf-8'),\r\n                           ('type', 'Dump docs')]))])\r\n```"}}
{"actor":{"display_login":"dangitall"}}