{"action":"created","issue":{"url":"https://api.github.com/repos/joelittlejohn/jsonschema2pojo/issues/535","repository_url":"https://api.github.com/repos/joelittlejohn/jsonschema2pojo","labels_url":"https://api.github.com/repos/joelittlejohn/jsonschema2pojo/issues/535/labels{/name}","comments_url":"https://api.github.com/repos/joelittlejohn/jsonschema2pojo/issues/535/comments","events_url":"https://api.github.com/repos/joelittlejohn/jsonschema2pojo/issues/535/events","html_url":"https://github.com/joelittlejohn/jsonschema2pojo/issues/535","id":142287561,"number":535,"title":"Wrong default value for BigDecimal","user":{"login":"JureVI","id":1044201,"avatar_url":"https://avatars.githubusercontent.com/u/1044201?v=3","gravatar_id":"","url":"https://api.github.com/users/JureVI","html_url":"https://github.com/JureVI","followers_url":"https://api.github.com/users/JureVI/followers","following_url":"https://api.github.com/users/JureVI/following{/other_user}","gists_url":"https://api.github.com/users/JureVI/gists{/gist_id}","starred_url":"https://api.github.com/users/JureVI/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JureVI/subscriptions","organizations_url":"https://api.github.com/users/JureVI/orgs","repos_url":"https://api.github.com/users/JureVI/repos","events_url":"https://api.github.com/users/JureVI/events{/privacy}","received_events_url":"https://api.github.com/users/JureVI/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/joelittlejohn/jsonschema2pojo/milestones/50","html_url":"https://github.com/joelittlejohn/jsonschema2pojo/milestones/0.4.23","labels_url":"https://api.github.com/repos/joelittlejohn/jsonschema2pojo/milestones/50/labels","id":1608729,"number":50,"title":"0.4.23","description":"","creator":{"login":"joelittlejohn","id":686384,"avatar_url":"https://avatars.githubusercontent.com/u/686384?v=3","gravatar_id":"","url":"https://api.github.com/users/joelittlejohn","html_url":"https://github.com/joelittlejohn","followers_url":"https://api.github.com/users/joelittlejohn/followers","following_url":"https://api.github.com/users/joelittlejohn/following{/other_user}","gists_url":"https://api.github.com/users/joelittlejohn/gists{/gist_id}","starred_url":"https://api.github.com/users/joelittlejohn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joelittlejohn/subscriptions","organizations_url":"https://api.github.com/users/joelittlejohn/orgs","repos_url":"https://api.github.com/users/joelittlejohn/repos","events_url":"https://api.github.com/users/joelittlejohn/events{/privacy}","received_events_url":"https://api.github.com/users/joelittlejohn/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":2,"state":"open","created_at":"2016-02-26T20:23:49Z","updated_at":"2016-03-21T08:49:17Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2016-03-21T08:45:56Z","updated_at":"2016-03-28T19:33:29Z","closed_at":null,"body":"It seems that if `useBigDecimals` is set to true and a numeric field has `default` property set, the generated Java file has the field initialized with Double value instead of BigDecimal.\r\n\r\nJson schema:\r\n```\r\n...\r\n\"amount\": {\r\n  \"type\": \"number\",\r\n  \"default\": 0,\r\n  ...\r\n}\r\n...\r\n```\r\nJava file:\r\n```\r\n...\r\n@SerializedName(\"amount\")\r\n@Expose\r\nprivate BigDecimal amount = 0.0D;\r\n...\r\n```\r\n\r\nThis is my gradle configuration:\r\n```\r\njsonSchema2Pojo {\r\n    generateBuilders = false\r\n    usePrimitives = false\r\n    source = ...\r\n    targetDirectory = ...\r\n    targetPackage = ...\r\n    propertyWordDelimiters = [] as char[]\r\n    useLongIntegers = false\r\n    useBigDecimals = true\r\n    includeHashcodeAndEquals = true\r\n    includeToString = true\r\n    includeJsr303Annotations = false\r\n    sourceType = 'jsonschema'\r\n    removeOldOutput = true\r\n    outputEncoding = 'UTF-8'\r\n    useJodaDates = false\r\n    useCommonsLang3 = false\r\n    initializeCollections = false\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/joelittlejohn/jsonschema2pojo/issues/comments/202548328","html_url":"https://github.com/joelittlejohn/jsonschema2pojo/issues/535#issuecomment-202548328","issue_url":"https://api.github.com/repos/joelittlejohn/jsonschema2pojo/issues/535","id":202548328,"user":{"login":"joelittlejohn","id":686384,"avatar_url":"https://avatars.githubusercontent.com/u/686384?v=3","gravatar_id":"","url":"https://api.github.com/users/joelittlejohn","html_url":"https://github.com/joelittlejohn","followers_url":"https://api.github.com/users/joelittlejohn/followers","following_url":"https://api.github.com/users/joelittlejohn/following{/other_user}","gists_url":"https://api.github.com/users/joelittlejohn/gists{/gist_id}","starred_url":"https://api.github.com/users/joelittlejohn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joelittlejohn/subscriptions","organizations_url":"https://api.github.com/users/joelittlejohn/orgs","repos_url":"https://api.github.com/users/joelittlejohn/repos","events_url":"https://api.github.com/users/joelittlejohn/events{/privacy}","received_events_url":"https://api.github.com/users/joelittlejohn/received_events","type":"User","site_admin":false},"created_at":"2016-03-28T19:33:29Z","updated_at":"2016-03-28T19:33:29Z","body":"I think it might be better to use the String constructor of BigDecimal, since it avoids a multitude of numeric representation issues and will create a BigDecimal that matches number given in the JSON Schema exactly."}}