{"action":"created","issue":{"url":"https://api.github.com/repos/pdvrieze/xmlutil/issues/11","repository_url":"https://api.github.com/repos/pdvrieze/xmlutil","labels_url":"https://api.github.com/repos/pdvrieze/xmlutil/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/pdvrieze/xmlutil/issues/11/comments","events_url":"https://api.github.com/repos/pdvrieze/xmlutil/issues/11/events","html_url":"https://github.com/pdvrieze/xmlutil/issues/11","id":464863816,"node_id":"MDU6SXNzdWU0NjQ4NjM4MTY=","number":11,"title":"Support for polymorphic deserializers base on tag name","user":{"login":"altavir","id":9514268,"node_id":"MDQ6VXNlcjk1MTQyNjg=","avatar_url":"https://avatars2.githubusercontent.com/u/9514268?v=4","gravatar_id":"","url":"https://api.github.com/users/altavir","html_url":"https://github.com/altavir","followers_url":"https://api.github.com/users/altavir/followers","following_url":"https://api.github.com/users/altavir/following{/other_user}","gists_url":"https://api.github.com/users/altavir/gists{/gist_id}","starred_url":"https://api.github.com/users/altavir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/altavir/subscriptions","organizations_url":"https://api.github.com/users/altavir/orgs","repos_url":"https://api.github.com/users/altavir/repos","events_url":"https://api.github.com/users/altavir/events{/privacy}","received_events_url":"https://api.github.com/users/altavir/received_events","type":"User","site_admin":false},"labels":[{"id":1451847440,"node_id":"MDU6TGFiZWwxNDUxODQ3NDQw","url":"https://api.github.com/repos/pdvrieze/xmlutil/labels/inmaster","name":"inmaster","color":"fef2c0","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2019-07-06T15:20:23Z","updated_at":"2019-07-16T09:42:25Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Suppose we have a sealed class hierarchy like this:\r\n```kotlin\r\nsealed class S\r\n\r\n@SerialName(\"a\")\r\nclass A: Parent()\r\n\r\n@SerialName(\"b\")\r\nclass b: Parent()\r\n\r\nclass Holder{\r\n  val children = ArrayList<@ContextualSerialization S>()\r\n}\r\n```\r\nThen we create an array of `S` and pass it to serializer via `ContextSerializer, obtaining something like\r\n```xml\r\n<Holder>\r\n  <a>...</a>\r\n  <b>...</b>\r\n</Holder>\r\n```\r\nCurrently deserializer tries to interpret those tags as fields. It is important to be able to somehow tell it that those are parts of the list."},"comment":{"url":"https://api.github.com/repos/pdvrieze/xmlutil/issues/comments/511745176","html_url":"https://github.com/pdvrieze/xmlutil/issues/11#issuecomment-511745176","issue_url":"https://api.github.com/repos/pdvrieze/xmlutil/issues/11","id":511745176,"node_id":"MDEyOklzc3VlQ29tbWVudDUxMTc0NTE3Ng==","user":{"login":"altavir","id":9514268,"node_id":"MDQ6VXNlcjk1MTQyNjg=","avatar_url":"https://avatars2.githubusercontent.com/u/9514268?v=4","gravatar_id":"","url":"https://api.github.com/users/altavir","html_url":"https://github.com/altavir","followers_url":"https://api.github.com/users/altavir/followers","following_url":"https://api.github.com/users/altavir/following{/other_user}","gists_url":"https://api.github.com/users/altavir/gists{/gist_id}","starred_url":"https://api.github.com/users/altavir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/altavir/subscriptions","organizations_url":"https://api.github.com/users/altavir/orgs","repos_url":"https://api.github.com/users/altavir/repos","events_url":"https://api.github.com/users/altavir/events{/privacy}","received_events_url":"https://api.github.com/users/altavir/received_events","type":"User","site_admin":false},"created_at":"2019-07-16T09:42:25Z","updated_at":"2019-07-16T09:42:25Z","author_association":"CONTRIBUTOR","body":"I've tried master build. It works for serialization, but does not seem to work for deserialization.\r\n\r\nThe problematic piece looks like this:\r\n```kotlin\r\n    //@XmlPolyChildren(arrayOf(\"constant\", \"quantity\", \"variable\", \"position\", \"rotation\", \"scale\", \"matrix\"))\r\n    val content = ArrayList<@Polymorphic GDMLDefine>()\r\n```\r\n\r\nThe module is properly defined:\r\n```kotlin\r\nval gdmlModule = SerializersModule {\r\n    polymorphic<GDMLDefine> {\r\n        GDMLRotation::class with GDMLRotation.serializer()\r\n        GDMLPosition::class with GDMLPosition.serializer()\r\n        GDMLConstant::class with GDMLConstant.serializer()\r\n        GDMLVariable::class with GDMLVariable.serializer()\r\n        GDMLQuantity::class with GDMLQuantity.serializer()\r\n        GDMLScale::class with GDMLScale.serializer()\r\n    }\r\n    ...\r\n}\r\n\r\n        val format = XML(gdmlModule) {\r\n            autoPolymorphic = true\r\n            indent = 4\r\n            unknownChildHandler = WARNING_UNKNOWN_CHILD_HANDLER\r\n        }\r\n```\r\nAnd I get the error:\r\n```\r\nscientifik.gdml.GDMLRotation is not registered for polymorphic serialization in the scope of class scientifik.gdml.GDMLDefine\r\n```\r\n\r\nMaybe I am missing some annotations?"}}
{"actor":{"display_login":"altavir"}}