{"action":"created","issue":{"url":"https://api.github.com/repos/nicolaiarocci/eve-swagger/issues/21","repository_url":"https://api.github.com/repos/nicolaiarocci/eve-swagger","labels_url":"https://api.github.com/repos/nicolaiarocci/eve-swagger/issues/21/labels{/name}","comments_url":"https://api.github.com/repos/nicolaiarocci/eve-swagger/issues/21/comments","events_url":"https://api.github.com/repos/nicolaiarocci/eve-swagger/issues/21/events","html_url":"https://github.com/nicolaiarocci/eve-swagger/pull/21","id":177572978,"number":21,"title":"Added support for data_relation","user":{"login":"otibsa","id":5006696,"avatar_url":"https://avatars.githubusercontent.com/u/5006696?v=3","gravatar_id":"","url":"https://api.github.com/users/otibsa","html_url":"https://github.com/otibsa","followers_url":"https://api.github.com/users/otibsa/followers","following_url":"https://api.github.com/users/otibsa/following{/other_user}","gists_url":"https://api.github.com/users/otibsa/gists{/gist_id}","starred_url":"https://api.github.com/users/otibsa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/otibsa/subscriptions","organizations_url":"https://api.github.com/users/otibsa/orgs","repos_url":"https://api.github.com/users/otibsa/repos","events_url":"https://api.github.com/users/otibsa/events{/privacy}","received_events_url":"https://api.github.com/users/otibsa/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-09-17T12:25:34Z","updated_at":"2016-09-23T08:50:15Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/nicolaiarocci/eve-swagger/pulls/21","html_url":"https://github.com/nicolaiarocci/eve-swagger/pull/21","diff_url":"https://github.com/nicolaiarocci/eve-swagger/pull/21.diff","patch_url":"https://github.com/nicolaiarocci/eve-swagger/pull/21.patch"},"body":"This PR adds a way to represent data_relations in the swagger doc. By creating a separate entry in `#/definitions/...` for each field that is mentioned in a data_relation in any resource, we can reference this `#/definitions/...` entry in the definitions of the resource that copies the field as well as in the resource that holds the original field.\r\n\r\nThis schema\r\n```python\r\npeople = {\r\n    ...\r\n    'item_title': 'person',\r\n    'schema': {\r\n        'name': {'type': 'string', 'description': 'This is the last name of a person', ...},\r\n        'birthdate': {...}\r\n    }\r\n}\r\ncars = {\r\n    ...\r\n    'schema': {\r\n        'owner': {\r\n            'data_relation': {'resource': 'people', 'field': 'name'}\r\n        },\r\n        'color': {...}\r\n    }\r\n}\r\n```\r\nresults in this swagger doc:\r\n```python\r\n'paths': { '/people/{personId}': {'get': {'responses': {\r\n    '200': {'schema': {'$ref': '#/definitions/person'}}\r\n}}}},\r\n'definitions': {\r\n    'person': {\r\n        ...\r\n        'properties': {\r\n            'name': {'$ref': '#/definitions/person_name'},\r\n            'birthdate': {...}\r\n        }\r\n    },\r\n    'car': {\r\n        'properties': {\r\n            'owner': {'$ref': '#/definitions/person_name'},\r\n            'color': {...}\r\n        }\r\n    },\r\n    'person_name': {\r\n        'type': 'string',\r\n        'description': 'This is the last name of a person'\r\n    }\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/nicolaiarocci/eve-swagger/issues/comments/249137692","html_url":"https://github.com/nicolaiarocci/eve-swagger/pull/21#issuecomment-249137692","issue_url":"https://api.github.com/repos/nicolaiarocci/eve-swagger/issues/21","id":249137692,"user":{"login":"otibsa","id":5006696,"avatar_url":"https://avatars.githubusercontent.com/u/5006696?v=3","gravatar_id":"","url":"https://api.github.com/users/otibsa","html_url":"https://github.com/otibsa","followers_url":"https://api.github.com/users/otibsa/followers","following_url":"https://api.github.com/users/otibsa/following{/other_user}","gists_url":"https://api.github.com/users/otibsa/gists{/gist_id}","starred_url":"https://api.github.com/users/otibsa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/otibsa/subscriptions","organizations_url":"https://api.github.com/users/otibsa/orgs","repos_url":"https://api.github.com/users/otibsa/repos","events_url":"https://api.github.com/users/otibsa/events{/privacy}","received_events_url":"https://api.github.com/users/otibsa/received_events","type":"User","site_admin":false},"created_at":"2016-09-23T08:50:15Z","updated_at":"2016-09-23T08:50:15Z","body":"rebased after #20 was merged"}}
{"actor":{"display_login":"otibsa"}}