{"action":"created","issue":{"url":"https://api.github.com/repos/swagger-api/swagger-core/issues/1997","repository_url":"https://api.github.com/repos/swagger-api/swagger-core","labels_url":"https://api.github.com/repos/swagger-api/swagger-core/issues/1997/labels{/name}","comments_url":"https://api.github.com/repos/swagger-api/swagger-core/issues/1997/comments","events_url":"https://api.github.com/repos/swagger-api/swagger-core/issues/1997/events","html_url":"https://github.com/swagger-api/swagger-core/issues/1997","id":188553579,"number":1997,"title":"Support for inheritance in ModelConvertor","user":{"login":"tschurins","id":12657872,"avatar_url":"https://avatars.githubusercontent.com/u/12657872?v=3","gravatar_id":"","url":"https://api.github.com/users/tschurins","html_url":"https://github.com/tschurins","followers_url":"https://api.github.com/users/tschurins/followers","following_url":"https://api.github.com/users/tschurins/following{/other_user}","gists_url":"https://api.github.com/users/tschurins/gists{/gist_id}","starred_url":"https://api.github.com/users/tschurins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tschurins/subscriptions","organizations_url":"https://api.github.com/users/tschurins/orgs","repos_url":"https://api.github.com/users/tschurins/repos","events_url":"https://api.github.com/users/tschurins/events{/privacy}","received_events_url":"https://api.github.com/users/tschurins/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-11-10T16:25:33Z","updated_at":"2016-12-24T18:40:33Z","closed_at":null,"body":"In our project we have created a ModelConvertor that creates models by introspection. It also navigates the whole class tree to determine which models have to be added (`ModelConverterContext.defineModel(...)`)\r\nThis works fine.\r\n\r\nNow we want to add inheritance by using `ComposedModel` with references and everything. This works well when a child model is added to the context, but it does not work at all when the model (the root) is returned by the `resolve` method.\r\n\r\nThe problem comes from the method `ModelResolver#resolveProperty`. There a check is done to see if the model implements ModelImpl, and if not no Property is returned:\r\n```java\r\n// complex type\r\nModel innerModel = context.resolve(propType);\r\nif (innerModel instanceof ModelImpl) {\r\n    ModelImpl mi = (ModelImpl) innerModel;\r\n    property = new RefProperty(StringUtils.isNotEmpty(mi.getReference()) ? mi.getReference() : mi.getName());\r\n}\r\n```\r\nLooking at the code, I see that the check on ModelImpl is needed only when the reference is not set on the model (reference is defined in the Model interface). \r\nIt could be improved by first checking if the reference is set, and if not checking if the type is ModelImpl &c. Like this, setting the reference on any type of model would work.\r\n\r\nWhat dou you think?\r\n"},"comment":{"url":"https://api.github.com/repos/swagger-api/swagger-core/issues/comments/269095649","html_url":"https://github.com/swagger-api/swagger-core/issues/1997#issuecomment-269095649","issue_url":"https://api.github.com/repos/swagger-api/swagger-core/issues/1997","id":269095649,"user":{"login":"fehguy","id":249413,"avatar_url":"https://avatars.githubusercontent.com/u/249413?v=3","gravatar_id":"","url":"https://api.github.com/users/fehguy","html_url":"https://github.com/fehguy","followers_url":"https://api.github.com/users/fehguy/followers","following_url":"https://api.github.com/users/fehguy/following{/other_user}","gists_url":"https://api.github.com/users/fehguy/gists{/gist_id}","starred_url":"https://api.github.com/users/fehguy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fehguy/subscriptions","organizations_url":"https://api.github.com/users/fehguy/orgs","repos_url":"https://api.github.com/users/fehguy/repos","events_url":"https://api.github.com/users/fehguy/events{/privacy}","received_events_url":"https://api.github.com/users/fehguy/received_events","type":"User","site_admin":false},"created_at":"2016-12-24T18:40:33Z","updated_at":"2016-12-24T18:40:33Z","body":"Seems like test case would be helpful for this.  In concept it sounds like it would be a good addition"}}
{"actor":{"display_login":"fehguy"}}