{"action":"created","issue":{"url":"https://api.github.com/repos/wuseal/JsonToKotlinClass/issues/69","repository_url":"https://api.github.com/repos/wuseal/JsonToKotlinClass","labels_url":"https://api.github.com/repos/wuseal/JsonToKotlinClass/issues/69/labels{/name}","comments_url":"https://api.github.com/repos/wuseal/JsonToKotlinClass/issues/69/comments","events_url":"https://api.github.com/repos/wuseal/JsonToKotlinClass/issues/69/events","html_url":"https://github.com/wuseal/JsonToKotlinClass/issues/69","id":346006321,"node_id":"MDU6SXNzdWUzNDYwMDYzMjE=","number":69,"title":"Deserialization doesn't work with Moshi + custom annotated properties","user":{"login":"gobetti","id":12944582,"node_id":"MDQ6VXNlcjEyOTQ0NTgy","avatar_url":"https://avatars0.githubusercontent.com/u/12944582?v=4","gravatar_id":"","url":"https://api.github.com/users/gobetti","html_url":"https://github.com/gobetti","followers_url":"https://api.github.com/users/gobetti/followers","following_url":"https://api.github.com/users/gobetti/following{/other_user}","gists_url":"https://api.github.com/users/gobetti/gists{/gist_id}","starred_url":"https://api.github.com/users/gobetti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gobetti/subscriptions","organizations_url":"https://api.github.com/users/gobetti/orgs","repos_url":"https://api.github.com/users/gobetti/repos","events_url":"https://api.github.com/users/gobetti/events{/privacy}","received_events_url":"https://api.github.com/users/gobetti/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-07-31T01:55:29Z","updated_at":"2018-07-31T02:24:46Z","closed_at":null,"author_association":"NONE","body":"Hi, this plugin is super awesome but I found this bug today where all of the annotated properties in my generated model failed to be deserialised. The annotations for Moshi were generated as `@Json` however one then needs to use this converter factory:\r\n```kotlin\r\n.addConverterFactory(MoshiConverterFactory.create(Moshi.Builder().add(KotlinJsonAdapterFactory()).build()))\r\n```\r\ninstead of the far simpler:\r\n```kotlin\r\n.addConverterFactory(MoshiConverterFactory.create())\r\n```\r\n@tfcporciuncula pointed me to a simpler solution that could be fixed inside JsonToKotlinClass plugin which is using the more explicit annotation `@field:Json`\r\n\r\ni.e.\r\n<details>\r\n  <summary><strong>Current implementation</strong></summary><p>\r\n\r\n```kotlin\r\n@Json(name = \"total_pages\")\r\nval totalPages: Int\r\n```\r\n\r\n</p></details>\r\n<details>\r\n  <summary><strong>Fixed implementation</strong></summary><p>\r\n\r\n```kotlin\r\n@field:Json(name = \"total_pages\")\r\nval totalPages: Int\r\n```\r\n\r\n</p></details>"},"comment":{"url":"https://api.github.com/repos/wuseal/JsonToKotlinClass/issues/comments/409072724","html_url":"https://github.com/wuseal/JsonToKotlinClass/issues/69#issuecomment-409072724","issue_url":"https://api.github.com/repos/wuseal/JsonToKotlinClass/issues/69","id":409072724,"node_id":"MDEyOklzc3VlQ29tbWVudDQwOTA3MjcyNA==","user":{"login":"wuseal","id":9211902,"node_id":"MDQ6VXNlcjkyMTE5MDI=","avatar_url":"https://avatars1.githubusercontent.com/u/9211902?v=4","gravatar_id":"","url":"https://api.github.com/users/wuseal","html_url":"https://github.com/wuseal","followers_url":"https://api.github.com/users/wuseal/followers","following_url":"https://api.github.com/users/wuseal/following{/other_user}","gists_url":"https://api.github.com/users/wuseal/gists{/gist_id}","starred_url":"https://api.github.com/users/wuseal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wuseal/subscriptions","organizations_url":"https://api.github.com/users/wuseal/orgs","repos_url":"https://api.github.com/users/wuseal/repos","events_url":"https://api.github.com/users/wuseal/events{/privacy}","received_events_url":"https://api.github.com/users/wuseal/received_events","type":"User","site_admin":false},"created_at":"2018-07-31T02:24:46Z","updated_at":"2018-07-31T02:24:46Z","author_association":"OWNER","body":"@gobetti  @tfcporciuncula Thanks for your feedback.Em. now you could use customize annotation option to solve your problem at first.\r\nI'll try to test the case you described. and fix the issue, if it does exist.\r\n"}}
{"actor":{"display_login":"wuseal"}}