{"action":"created","issue":{"url":"https://api.github.com/repos/mission-liao/pyswagger/issues/49","labels_url":"https://api.github.com/repos/mission-liao/pyswagger/issues/49/labels{/name}","comments_url":"https://api.github.com/repos/mission-liao/pyswagger/issues/49/comments","events_url":"https://api.github.com/repos/mission-liao/pyswagger/issues/49/events","html_url":"https://github.com/mission-liao/pyswagger/pull/49","id":119155687,"number":49,"title":"Content-Type support other than application/json","user":{"login":"WangJiannan","id":2433660,"avatar_url":"https://avatars.githubusercontent.com/u/2433660?v=3","gravatar_id":"","url":"https://api.github.com/users/WangJiannan","html_url":"https://github.com/WangJiannan","followers_url":"https://api.github.com/users/WangJiannan/followers","following_url":"https://api.github.com/users/WangJiannan/following{/other_user}","gists_url":"https://api.github.com/users/WangJiannan/gists{/gist_id}","starred_url":"https://api.github.com/users/WangJiannan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WangJiannan/subscriptions","organizations_url":"https://api.github.com/users/WangJiannan/orgs","repos_url":"https://api.github.com/users/WangJiannan/repos","events_url":"https://api.github.com/users/WangJiannan/events{/privacy}","received_events_url":"https://api.github.com/users/WangJiannan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2015-11-27T08:57:47Z","updated_at":"2016-01-30T17:24:55Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/mission-liao/pyswagger/pulls/49","html_url":"https://github.com/mission-liao/pyswagger/pull/49","diff_url":"https://github.com/mission-liao/pyswagger/pull/49.diff","patch_url":"https://github.com/mission-liao/pyswagger/pull/49.patch"},"body":"pyswagger requires swagger operation consume and produce in application/json format. To support other content-type (application/xml, application/x-protobuf, etc.), I draft a commit.\r\n\r\nHere is my usage:\r\n```python\r\nclass XmlCodec:\r\n    def marshal(self, _type, _format, value):\r\n        return '<?xml version=\"1.0\" encoding=\"UTF-8\" ?>' + dicttoxml.dicttoxml(value, root=False, attr_type=False)\r\n\r\n    def unmarshal(self, _type, _format, data):\r\n        return xmltodict.parse(data)\r\n\r\n\r\ndef _create_mime_codec():\r\n    mime_codec = MimeCodec()\r\n    xmlCodec = XmlCodec()\r\n    for _type in ['application', 'text']:\r\n        mime_codec.register('%s/xml' % _type, xmlCodec)\r\n    return mime_codec\r\n\r\n\r\n_mime_codec = _create_mime_codec()\r\n\r\napp = SwaggerApp.load(filepath, mime_codec=_mime_codec)\r\nclient = Client()\r\nop = app.op['op']\r\npet_Tom=dict(id=1, name='Tom', photoUrls=['http://test'])\r\n# use default/first consume/produce\r\nclient.request(op(body=pet_Tom))\r\n# consume 'application/xml'\r\nclient.request(op('application/xml', body=pet_Tom))\r\n# consume 'application/xml', produce 'application/json'\r\nclient.request(op('application/xml', 'application/json', body=pet_Tom))\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/mission-liao/pyswagger/issues/comments/177255956","html_url":"https://github.com/mission-liao/pyswagger/pull/49#issuecomment-177255956","issue_url":"https://api.github.com/repos/mission-liao/pyswagger/issues/49","id":177255956,"user":{"login":"mission-liao","id":1988671,"avatar_url":"https://avatars.githubusercontent.com/u/1988671?v=3","gravatar_id":"","url":"https://api.github.com/users/mission-liao","html_url":"https://github.com/mission-liao","followers_url":"https://api.github.com/users/mission-liao/followers","following_url":"https://api.github.com/users/mission-liao/following{/other_user}","gists_url":"https://api.github.com/users/mission-liao/gists{/gist_id}","starred_url":"https://api.github.com/users/mission-liao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mission-liao/subscriptions","organizations_url":"https://api.github.com/users/mission-liao/orgs","repos_url":"https://api.github.com/users/mission-liao/repos","events_url":"https://api.github.com/users/mission-liao/events{/privacy}","received_events_url":"https://api.github.com/users/mission-liao/received_events","type":"User","site_admin":false},"created_at":"2016-01-30T17:24:55Z","updated_at":"2016-01-30T17:24:55Z","body":"Hi, I'm very appreciate for your work, it's really nice to see things still going on. Before you proceeding, make sure to rebase to current code base (maybe resubmit a PR if possible)"}}