{"action":"closed","issue":{"url":"https://api.github.com/repos/jamesagnew/hapi-fhir/issues/327","repository_url":"https://api.github.com/repos/jamesagnew/hapi-fhir","labels_url":"https://api.github.com/repos/jamesagnew/hapi-fhir/issues/327/labels{/name}","comments_url":"https://api.github.com/repos/jamesagnew/hapi-fhir/issues/327/comments","events_url":"https://api.github.com/repos/jamesagnew/hapi-fhir/issues/327/events","html_url":"https://github.com/jamesagnew/hapi-fhir/issues/327","id":146418103,"number":327,"title":"Extension for contained resource Reference does not serialize to JSON or XML properly. ","user":{"login":"fw060","id":15931214,"avatar_url":"https://avatars.githubusercontent.com/u/15931214?v=3","gravatar_id":"","url":"https://api.github.com/users/fw060","html_url":"https://github.com/fw060","followers_url":"https://api.github.com/users/fw060/followers","following_url":"https://api.github.com/users/fw060/following{/other_user}","gists_url":"https://api.github.com/users/fw060/gists{/gist_id}","starred_url":"https://api.github.com/users/fw060/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fw060/subscriptions","organizations_url":"https://api.github.com/users/fw060/orgs","repos_url":"https://api.github.com/users/fw060/repos","events_url":"https://api.github.com/users/fw060/events{/privacy}","received_events_url":"https://api.github.com/users/fw060/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":12,"created_at":"2016-04-06T20:06:18Z","updated_at":"2016-10-14T21:35:08Z","closed_at":"2016-10-14T21:35:08Z","body":"See the following test code: \r\n\r\n```\r\n@ResourceDef(name=\"Patient\")\r\npublic class TestPatient extends Patient\r\n{\r\n\r\n\t@Child(name = \"testCondition\")\r\n    @Extension(url=\"testCondition\", definedLocally=true, isModifier=false)\r\n\tprivate List<Reference> testConditions = null;\r\n\t\r\n\tpublic void setCondition(List<Reference> ref)\r\n\t{\r\n\t\tthis.testConditions = ref;\r\n\t}\r\n\t\r\n\tpublic List<Reference> getConditions()\r\n\t{\r\n\t\treturn this.testConditions;\r\n\t}\r\n}\r\n```\r\n\r\nPatientProvider class: \r\n```\r\n\t@Read()\r\n\tpublic Patient read(@IdParam IdType theId) {\r\n\t\t\r\n\t\t\r\n\t\tTestPatient patient = new TestPatient();\r\n\t\tpatient.setBirthDate(new Date());\r\n\t\t\r\n\t\tList<Reference> conditions = new ArrayList<>();\r\n\t\tconditions.add(new Reference(new Condition()));\r\n\t\tpatient.setCondition(conditions);\r\n\t\t\r\n\t\t\r\n\t\treturn patient;\r\n\t}\r\n\r\n\r\n```\r\n\r\nTest result is :\r\n```\r\n{\r\n  \"resourceType\": \"Patient\",\r\n  \"extension\": [\r\n    {\r\n      \"url\": \"testCondition\",\r\n      \"valueReference\": {}\r\n    }\r\n  ],\r\n  \"contained\": [\r\n    {\r\n      \"resourceType\": \"Condition\",\r\n      \"id\": \"1\"\r\n    }\r\n  ],\r\n  \"birthDate\": \"2016-04-06\"\r\n}\r\n```"}}
{"actor":{"display_login":"jamesagnew"}}