{"action":"created","issue":{"url":"https://api.github.com/repos/mbknor/mbknor-jackson-jsonSchema/issues/6","repository_url":"https://api.github.com/repos/mbknor/mbknor-jackson-jsonSchema","labels_url":"https://api.github.com/repos/mbknor/mbknor-jackson-jsonSchema/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/mbknor/mbknor-jackson-jsonSchema/issues/6/comments","events_url":"https://api.github.com/repos/mbknor/mbknor-jackson-jsonSchema/issues/6/events","html_url":"https://github.com/mbknor/mbknor-jackson-jsonSchema/issues/6","id":180838047,"number":6,"title":"The Shema Generator ignores JsonSubTypes-Infos added via JacksonMixInAnnotations","user":{"login":"MaximilianFranke","id":10807500,"avatar_url":"https://avatars.githubusercontent.com/u/10807500?v=3","gravatar_id":"","url":"https://api.github.com/users/MaximilianFranke","html_url":"https://github.com/MaximilianFranke","followers_url":"https://api.github.com/users/MaximilianFranke/followers","following_url":"https://api.github.com/users/MaximilianFranke/following{/other_user}","gists_url":"https://api.github.com/users/MaximilianFranke/gists{/gist_id}","starred_url":"https://api.github.com/users/MaximilianFranke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MaximilianFranke/subscriptions","organizations_url":"https://api.github.com/users/MaximilianFranke/orgs","repos_url":"https://api.github.com/users/MaximilianFranke/repos","events_url":"https://api.github.com/users/MaximilianFranke/events{/privacy}","received_events_url":"https://api.github.com/users/MaximilianFranke/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":{"login":"mbknor","id":203254,"avatar_url":"https://avatars.githubusercontent.com/u/203254?v=3","gravatar_id":"","url":"https://api.github.com/users/mbknor","html_url":"https://github.com/mbknor","followers_url":"https://api.github.com/users/mbknor/followers","following_url":"https://api.github.com/users/mbknor/following{/other_user}","gists_url":"https://api.github.com/users/mbknor/gists{/gist_id}","starred_url":"https://api.github.com/users/mbknor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbknor/subscriptions","organizations_url":"https://api.github.com/users/mbknor/orgs","repos_url":"https://api.github.com/users/mbknor/repos","events_url":"https://api.github.com/users/mbknor/events{/privacy}","received_events_url":"https://api.github.com/users/mbknor/received_events","type":"User","site_admin":false},"assignees":[{"login":"mbknor","id":203254,"avatar_url":"https://avatars.githubusercontent.com/u/203254?v=3","gravatar_id":"","url":"https://api.github.com/users/mbknor","html_url":"https://github.com/mbknor","followers_url":"https://api.github.com/users/mbknor/followers","following_url":"https://api.github.com/users/mbknor/following{/other_user}","gists_url":"https://api.github.com/users/mbknor/gists{/gist_id}","starred_url":"https://api.github.com/users/mbknor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbknor/subscriptions","organizations_url":"https://api.github.com/users/mbknor/orgs","repos_url":"https://api.github.com/users/mbknor/repos","events_url":"https://api.github.com/users/mbknor/events{/privacy}","received_events_url":"https://api.github.com/users/mbknor/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/mbknor/mbknor-jackson-jsonSchema/milestones/1","html_url":"https://github.com/mbknor/mbknor-jackson-jsonSchema/milestones/1.0.8","labels_url":"https://api.github.com/repos/mbknor/mbknor-jackson-jsonSchema/milestones/1/labels","id":2074334,"number":1,"title":"1.0.8","description":"","creator":{"login":"mbknor","id":203254,"avatar_url":"https://avatars.githubusercontent.com/u/203254?v=3","gravatar_id":"","url":"https://api.github.com/users/mbknor","html_url":"https://github.com/mbknor","followers_url":"https://api.github.com/users/mbknor/followers","following_url":"https://api.github.com/users/mbknor/following{/other_user}","gists_url":"https://api.github.com/users/mbknor/gists{/gist_id}","starred_url":"https://api.github.com/users/mbknor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbknor/subscriptions","organizations_url":"https://api.github.com/users/mbknor/orgs","repos_url":"https://api.github.com/users/mbknor/repos","events_url":"https://api.github.com/users/mbknor/events{/privacy}","received_events_url":"https://api.github.com/users/mbknor/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":2,"state":"closed","created_at":"2016-10-17T12:29:12Z","updated_at":"2016-10-17T20:38:15Z","due_on":"2016-10-17T00:00:00Z","closed_at":"2016-10-17T20:38:15Z"},"comments":5,"created_at":"2016-10-04T08:54:27Z","updated_at":"2016-10-17T20:40:13Z","closed_at":"2016-10-12T19:38:34Z","body":"JsonSubTypes-Infos added via JacksonMixInAnnotations ( see http://wiki.fasterxml.com/JacksonMixInAnnotations ) are ignored.\r\n\r\nHere is my sample Code, written in Java:\r\n```\r\n// sample_zoo.json:\r\n//{\r\n//\t\"animals\":\r\n//     [\r\n//       {\"type\":\"dog\",\"name\":\"Spike\",\"breed\":\"mutt\",\r\n//           \"leashColor\":\"red\"},\r\n//       {\"type\":\"cat\",\"name\":\"Fluffy\",\r\n//           \"favoriteToy\":\"spider ring\"}\r\n//     ]\r\n//}\r\n\r\npackage jacksontest;\r\n\r\nimport java.util.List;\r\n\r\nimport org.slf4j.Logger;\r\n\r\nimport scala.Option;\r\nimport scala.Some;\r\n\r\nimport com.fasterxml.jackson.annotation.JsonSubTypes;\r\nimport com.fasterxml.jackson.annotation.JsonSubTypes.Type;\r\nimport com.fasterxml.jackson.annotation.JsonTypeInfo;\r\nimport com.fasterxml.jackson.databind.JsonNode;\r\nimport com.fasterxml.jackson.databind.ObjectMapper;\r\nimport com.fasterxml.jackson.databind.module.SimpleModule;\r\nimport com.kjetland.jackson.jsonSchema.JsonSchemaConfig;\r\nimport com.kjetland.jackson.jsonSchema.JsonSchemaGenerator;\r\n\r\npublic class Foo {\r\n\tstatic Logger logger = org.slf4j.LoggerFactory.getLogger(Foo.class);\r\n\r\n\tstatic class Zoo {\r\n\t\tpublic List<Animal> animals;\r\n\t}\r\n\r\n\tstatic abstract class Animal {\r\n\t\tpublic String name;\r\n\t}\r\n\r\n\tstatic class Dog extends Animal {\r\n\t\tpublic String breed;\r\n\t\tpublic String leashColor;\r\n\t}\r\n\r\n\tstatic class Cat extends Animal {\r\n\t\tpublic String favoriteToy;\r\n\t}\r\n\r\n\tstatic class MyModule extends SimpleModule {\r\n\t\t@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = \"type\")\r\n\t\t@JsonSubTypes({ @Type(value = Dog.class, name = \"dog\"), @Type(value = Cat.class, name = \"cat\") })\r\n\t\tabstract class MixIn {\r\n\r\n\t\t}\r\n\r\n\t\t@Override\r\n\t\tpublic void setupModule(SetupContext context) {\r\n\t\t\tcontext.setMixInAnnotations(Animal.class, MixIn.class);\r\n\t\t}\r\n\t}\r\n\r\n\tpublic static void main(String[] args) throws Exception {\r\n\t\tObjectMapper mapper = new ObjectMapper();\r\n\t\tmapper.registerModule(new MyModule());\r\n\r\n\t\t// jackson read and write test\r\n\t\tZoo zoo = mapper.readValue(Foo.class.getResourceAsStream(\"./sample_zoo.json\"), Zoo.class);\r\n\t\tlogger.info(mapper.writerWithDefaultPrettyPrinter().writeValueAsString(zoo));\r\n\r\n\t\t// Html5 Schema generator test\r\n\t\ttry {\r\n\t\t\tJsonSchemaGenerator html5 = new JsonSchemaGenerator(mapper, JsonSchemaConfig.html5EnabledSchema());\r\n\t\t\tOption<String> title = new Some<String>(\"MyZooTitle\");\r\n\t\t\tOption<String> description = new Some<String>(\"MyZooDescription\");\r\n\t\t\tJsonNode schema = html5.generateJsonSchema(Zoo.class, title, description);\r\n\t\t\tlogger.info(mapper.writerWithDefaultPrettyPrinter().writeValueAsString(schema));\r\n\t\t} catch (Exception e) {\r\n\t\t\tlogger.error(\"Unexpected exception\", e);\r\n\t\t}\r\n\r\n\t}\r\n}\r\n```\r\n\r\n\r\nHere is the output with Exception:\r\n```\r\n2016-10-04T10:36:01.730 INFO  [jacksontest.Foo] - {\r\n  \"animals\" : [ {\r\n    \"type\" : \"dog\",\r\n    \"name\" : \"Spike\",\r\n    \"breed\" : \"mutt\",\r\n    \"leashColor\" : \"red\"\r\n  }, {\r\n    \"type\" : \"cat\",\r\n    \"name\" : \"Fluffy\",\r\n    \"favoriteToy\" : \"spider ring\"\r\n  } ]\r\n}\r\n2016-10-04T10:36:01.845 ERROR [jacksontest.Foo] - Unexpected exception\r\njava.lang.Exception: Did not find info about the class class jacksontest.Foo$Animal in @JsonSubTypes\r\n\tat com.kjetland.jackson.jsonSchema.JsonSchemaGenerator$MyJsonFormatVisitorWrapper$$anonfun$com$kjetland$jackson$jsonSchema$JsonSchemaGenerator$MyJsonFormatVisitorWrapper$$extractPolymorphismInfo$1$$anonfun$3$$anonfun$apply$12.apply(JsonSchemaGenerator.scala:435)\r\n\tat com.kjetland.jackson.jsonSchema.JsonSchemaGenerator$MyJsonFormatVisitorWrapper$$anonfun$com$kjetland$jackson$jsonSchema$JsonSchemaGenerator$MyJsonFormatVisitorWrapper$$extractPolymorphismInfo$1$$anonfun$3$$anonfun$apply$12.apply(JsonSchemaGenerator.scala:435)\r\n\tat scala.Option.getOrElse(Option.scala:121)\r\n\tat com.kjetland.jackson.jsonSchema.JsonSchemaGenerator$MyJsonFormatVisitorWrapper$$anonfun$com$kjetland$jackson$jsonSchema$JsonSchemaGenerator$MyJsonFormatVisitorWrapper$$extractPolymorphismInfo$1$$anonfun$3.apply(JsonSchemaGenerator.scala:435)\r\n\tat com.kjetland.jackson.jsonSchema.JsonSchemaGenerator$MyJsonFormatVisitorWrapper$$anonfun$com$kjetland$jackson$jsonSchema$JsonSchemaGenerator$MyJsonFormatVisitorWrapper$$extractPolymorphismInfo$1$$anonfun$3.apply(JsonSchemaGenerator.scala:431)\r\n\tat scala.Option.map(Option.scala:146)\r\n\tat com.kjetland.jackson.jsonSchema.JsonSchemaGenerator$MyJsonFormatVisitorWrapper$$anonfun$com$kjetland$jackson$jsonSchema$JsonSchemaGenerator$MyJsonFormatVisitorWrapper$$extractPolymorphismInfo$1.apply(JsonSchemaGenerator.scala:430)\r\n\tat com.kjetland.jackson.jsonSchema.JsonSchemaGenerator$MyJsonFormatVisitorWrapper$$anonfun$com$kjetland$jackson$jsonSchema$JsonSchemaGenerator$MyJsonFormatVisitorWrapper$$extractPolymorphismInfo$1.apply(JsonSchemaGenerator.scala:421)\r\n\tat scala.Option.map(Option.scala:146)\r\n\tat com.kjetland.jackson.jsonSchema.JsonSchemaGenerator$MyJsonFormatVisitorWrapper.com$kjetland$jackson$jsonSchema$JsonSchemaGenerator$MyJsonFormatVisitorWrapper$$extractPolymorphismInfo(JsonSchemaGenerator.scala:420)\r\n\tat com.kjetland.jackson.jsonSchema.JsonSchemaGenerator$MyJsonFormatVisitorWrapper$$anonfun$8.apply(JsonSchemaGenerator.scala:510)\r\n\tat com.kjetland.jackson.jsonSchema.JsonSchemaGenerator$MyJsonFormatVisitorWrapper$$anonfun$8.apply(JsonSchemaGenerator.scala:483)\r\n\tat com.kjetland.jackson.jsonSchema.JsonSchemaGenerator$DefinitionsHandler.getOrCreateDefinition(JsonSchemaGenerator.scala:184)\r\n\tat com.kjetland.jackson.jsonSchema.JsonSchemaGenerator$MyJsonFormatVisitorWrapper.expectObjectFormat(JsonSchemaGenerator.scala:704)\r\n\tat com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.acceptJsonFormatVisitor(BeanSerializerBase.java:809)\r\n\tat com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.acceptJsonFormatVisitor(DefaultSerializerProvider.java:580)\r\n\tat com.fasterxml.jackson.databind.ObjectMapper.acceptJsonFormatVisitor(ObjectMapper.java:3641)\r\n\tat com.kjetland.jackson.jsonSchema.JsonSchemaGenerator$MyJsonFormatVisitorWrapper$$anon$2.itemsFormat(JsonSchemaGenerator.scala:286)\r\n\tat com.kjetland.jackson.jsonSchema.JsonSchemaGenerator$MyJsonFormatVisitorWrapper$$anonfun$8$$anon$7.myPropertyHandler(JsonSchemaGenerator.scala:611)\r\n\tat com.kjetland.jackson.jsonSchema.JsonSchemaGenerator$MyJsonFormatVisitorWrapper$$anonfun$8$$anon$7.optionalProperty(JsonSchemaGenerator.scala:680)\r\n\tat com.fasterxml.jackson.databind.ser.BeanPropertyWriter.depositSchemaProperty(BeanPropertyWriter.java:805)\r\n\tat com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.acceptJsonFormatVisitor(BeanSerializerBase.java:833)\r\n\tat com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.acceptJsonFormatVisitor(DefaultSerializerProvider.java:580)\r\n\tat com.fasterxml.jackson.databind.ObjectMapper.acceptJsonFormatVisitor(ObjectMapper.java:3641)\r\n\tat com.fasterxml.jackson.databind.ObjectMapper.acceptJsonFormatVisitor(ObjectMapper.java:3620)\r\n\tat com.kjetland.jackson.jsonSchema.JsonSchemaGenerator.generateJsonSchema(JsonSchemaGenerator.scala:807)\r\n\tat jacksontest.Foo.main(Foo.java:76)\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/mbknor/mbknor-jackson-jsonSchema/issues/comments/254327031","html_url":"https://github.com/mbknor/mbknor-jackson-jsonSchema/issues/6#issuecomment-254327031","issue_url":"https://api.github.com/repos/mbknor/mbknor-jackson-jsonSchema/issues/6","id":254327031,"user":{"login":"mbknor","id":203254,"avatar_url":"https://avatars.githubusercontent.com/u/203254?v=3","gravatar_id":"","url":"https://api.github.com/users/mbknor","html_url":"https://github.com/mbknor","followers_url":"https://api.github.com/users/mbknor/followers","following_url":"https://api.github.com/users/mbknor/following{/other_user}","gists_url":"https://api.github.com/users/mbknor/gists{/gist_id}","starred_url":"https://api.github.com/users/mbknor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbknor/subscriptions","organizations_url":"https://api.github.com/users/mbknor/orgs","repos_url":"https://api.github.com/users/mbknor/repos","events_url":"https://api.github.com/users/mbknor/events{/privacy}","received_events_url":"https://api.github.com/users/mbknor/received_events","type":"User","site_admin":false},"created_at":"2016-10-17T20:40:13Z","updated_at":"2016-10-17T20:40:13Z","body":"1.0.8 has now been released"}}
{"actor":{"display_login":"mbknor"}}