{"action":"created","issue":{"url":"https://api.github.com/repos/OpenAPITools/openapi-generator/issues/4785","repository_url":"https://api.github.com/repos/OpenAPITools/openapi-generator","labels_url":"https://api.github.com/repos/OpenAPITools/openapi-generator/issues/4785/labels{/name}","comments_url":"https://api.github.com/repos/OpenAPITools/openapi-generator/issues/4785/comments","events_url":"https://api.github.com/repos/OpenAPITools/openapi-generator/issues/4785/events","html_url":"https://github.com/OpenAPITools/openapi-generator/pull/4785","id":537475130,"node_id":"MDExOlB1bGxSZXF1ZXN0MzUyODIzNDYz","number":4785,"title":"[Java][client] oneof support for jackson clients","user":{"login":"bkabrda","id":1050061,"node_id":"MDQ6VXNlcjEwNTAwNjE=","avatar_url":"https://avatars1.githubusercontent.com/u/1050061?v=4","gravatar_id":"","url":"https://api.github.com/users/bkabrda","html_url":"https://github.com/bkabrda","followers_url":"https://api.github.com/users/bkabrda/followers","following_url":"https://api.github.com/users/bkabrda/following{/other_user}","gists_url":"https://api.github.com/users/bkabrda/gists{/gist_id}","starred_url":"https://api.github.com/users/bkabrda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bkabrda/subscriptions","organizations_url":"https://api.github.com/users/bkabrda/orgs","repos_url":"https://api.github.com/users/bkabrda/repos","events_url":"https://api.github.com/users/bkabrda/events{/privacy}","received_events_url":"https://api.github.com/users/bkabrda/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"jimschubert","id":109659,"node_id":"MDQ6VXNlcjEwOTY1OQ==","avatar_url":"https://avatars2.githubusercontent.com/u/109659?v=4","gravatar_id":"","url":"https://api.github.com/users/jimschubert","html_url":"https://github.com/jimschubert","followers_url":"https://api.github.com/users/jimschubert/followers","following_url":"https://api.github.com/users/jimschubert/following{/other_user}","gists_url":"https://api.github.com/users/jimschubert/gists{/gist_id}","starred_url":"https://api.github.com/users/jimschubert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimschubert/subscriptions","organizations_url":"https://api.github.com/users/jimschubert/orgs","repos_url":"https://api.github.com/users/jimschubert/repos","events_url":"https://api.github.com/users/jimschubert/events{/privacy}","received_events_url":"https://api.github.com/users/jimschubert/received_events","type":"User","site_admin":false},"assignees":[{"login":"jimschubert","id":109659,"node_id":"MDQ6VXNlcjEwOTY1OQ==","avatar_url":"https://avatars2.githubusercontent.com/u/109659?v=4","gravatar_id":"","url":"https://api.github.com/users/jimschubert","html_url":"https://github.com/jimschubert","followers_url":"https://api.github.com/users/jimschubert/followers","following_url":"https://api.github.com/users/jimschubert/following{/other_user}","gists_url":"https://api.github.com/users/jimschubert/gists{/gist_id}","starred_url":"https://api.github.com/users/jimschubert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimschubert/subscriptions","organizations_url":"https://api.github.com/users/jimschubert/orgs","repos_url":"https://api.github.com/users/jimschubert/repos","events_url":"https://api.github.com/users/jimschubert/events{/privacy}","received_events_url":"https://api.github.com/users/jimschubert/received_events","type":"User","site_admin":false}],"milestone":null,"comments":5,"created_at":"2019-12-13T10:39:48Z","updated_at":"2020-01-09T14:23:49Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/OpenAPITools/openapi-generator/pulls/4785","html_url":"https://github.com/OpenAPITools/openapi-generator/pull/4785","diff_url":"https://github.com/OpenAPITools/openapi-generator/pull/4785.diff","patch_url":"https://github.com/OpenAPITools/openapi-generator/pull/4785.patch"},"body":"This PR represents implementation of `oneOf` support for Java clients that use Jackson as serialization library. I based this on discussion in #15.\r\n\r\nThis implements `oneOf` in the following way:\r\n\r\n* The object/property that holds `oneOf` mapping is generated as an `interface` with proper jackson `JsonSubTypes` decorator derived from `discriminator` - this makes it possible for jackson to detect the implementing class that should be used when deserializing.\r\n* The objects referenced in `oneOf` implement this interface.\r\n* A getter for the discriminator attribute is generated in the above mentioned interface, making it easy to write code such as (assuming the API response contains `x`, which is the `oneOf` interface):`if (x.getType() == \"type1\") { Type1 type1 = (Type1) x };`\r\n* If there are any additional properties defined on the `oneOf`-containing object, they are added to all of the `oneOf` members.\r\n\r\nLimitations:\r\n\r\n* Doesn't work with inline-defined (non-ref) members of `oneOf`.\r\n* Doesn't work if discriminator is not used (more specifically, it won't be able to deserialize API responses, as the `JsonSubTypes` decorator on the interface will be empty).\r\n* Currently it is assumed that the discriminator property has `string` type (this could probably be fixed).\r\n\r\nI'll appreciate any feedback on this and will be happy to implement more improvements if someone has suggestions.\r\n\r\n<!-- Please check the completed items below -->\r\n### PR checklist\r\n\r\n- [x] Read the [contribution guidelines](https://github.com/openapitools/openapi-generator/blob/master/CONTRIBUTING.md).\r\n- [x] If contributing template-only or documentation-only changes which will change sample output, [build the project](https://github.com/OpenAPITools/openapi-generator#14---build-projects) before.\r\n- [x] Run the shell script(s) under `./bin/` (or Windows batch scripts under`.\\bin\\windows`) to update Petstore samples related to your fix. This is important, as CI jobs will verify _all_ generator outputs of your HEAD commit, and these must match the expectations made by your contribution. You only need to run `./bin/{LANG}-petstore.sh`, `./bin/openapi3/{LANG}-petstore.sh` if updating the code or mustache templates for a language (`{LANG}`) (e.g. php, ruby, python, etc).\r\n- [x] File the PR against the [correct branch](https://github.com/OpenAPITools/openapi-generator/wiki/Git-Branches): `master`, `4.3.x`, `5.0.x`. Default: `master`.\r\n- [x] Copy the [technical committee](https://github.com/openapitools/openapi-generator/#62---openapi-generator-technical-committee) to review the pull request if your PR is targeting a particular programming language.\r\n\r\n@bbdouglas (2017/07) @sreeshas (2017/08) @jfiala (2017/08) @lukoyanov (2017/09) @cbornet (2017/09) @jeff9finger (2018/01) @karismann (2019/03) @Zomzog (2019/04) @lwlee2608 (2019/10)"},"comment":{"url":"https://api.github.com/repos/OpenAPITools/openapi-generator/issues/comments/572583292","html_url":"https://github.com/OpenAPITools/openapi-generator/pull/4785#issuecomment-572583292","issue_url":"https://api.github.com/repos/OpenAPITools/openapi-generator/issues/4785","id":572583292,"node_id":"MDEyOklzc3VlQ29tbWVudDU3MjU4MzI5Mg==","user":{"login":"jimschubert","id":109659,"node_id":"MDQ6VXNlcjEwOTY1OQ==","avatar_url":"https://avatars2.githubusercontent.com/u/109659?v=4","gravatar_id":"","url":"https://api.github.com/users/jimschubert","html_url":"https://github.com/jimschubert","followers_url":"https://api.github.com/users/jimschubert/followers","following_url":"https://api.github.com/users/jimschubert/following{/other_user}","gists_url":"https://api.github.com/users/jimschubert/gists{/gist_id}","starred_url":"https://api.github.com/users/jimschubert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimschubert/subscriptions","organizations_url":"https://api.github.com/users/jimschubert/orgs","repos_url":"https://api.github.com/users/jimschubert/repos","events_url":"https://api.github.com/users/jimschubert/events{/privacy}","received_events_url":"https://api.github.com/users/jimschubert/received_events","type":"User","site_admin":false},"created_at":"2020-01-09T14:23:49Z","updated_at":"2020-01-09T14:23:49Z","author_association":"MEMBER","body":"@bkabrda in that last example how would I access `Cat#name`? I think I'm confused about the intention to break out `AnimalInterface`. Are your derived classes missing an `extends`, or do you mean you'd have an option to ignore properties on the discriminated type (`Animal` in your example)?"}}
{"actor":{"display_login":"jimschubert"}}