forked from samply/golang-fhir-models
-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
When marshalling a Task with input (type TaskInput) set, it marshals all empty fields as well. I see that this works for Observation, as the value options are defined as pointers (with omitempty).
I'm somewhat new to FHIR, but if you point me to the right direction I can give it a go fixing it (thanks in advance).
For example, the following test:
func TestMarshalTask(t *testing.T) {
task := Task{}
task.Input = []TaskInput{
{
ValueInteger: 5,
},
}
data, _ := json.MarshalIndent(task, "", " ")
println(string(data))
}gives:
{
"status": "draft",
"intent": "",
"input": [
{
"type": {},
"valueBase64Binary": "",
"valueBoolean": false,
"valueCanonical": "",
"valueCode": "",
"valueDate": "",
"valueDateTime": "",
"valueDecimal": 0,
"valueID": "",
"valueInstant": "",
"valueInteger": 5,
"valueMarkdown": "",
"valueOid": "",
"valuePositiveInt": 0,
"valueString": "",
"valueTime": "",
"valueUnsignedInt": 0,
"valueUri": "",
"valueUrl": "",
"valueUuid": "",
"valueAddress": {},
"valueAge": {},
"valueAnnotation": {
"text": ""
},
"valueAttachment": {},
"valueCodeableConcept": {},
"valueCoding": {},
"valueContactPoint": {},
"valueCount": {},
"valueDistance": {},
"valueDuration": {},
"valueHumanName": {},
"valueIdentifier": {},
"valueMoney": {},
"valuePeriod": {},
"valueQuantity": {},
"valueRange": {},
"valueRatio": {},
"valueReference": {},
"valueSampledData": {
"origin": {},
"period": 0,
"dimensions": 0
},
"valueSignature": {
"type": null,
"when": "",
"who": {}
},
"valueTiming": {},
"valueContactDetail": {},
"valueContributor": {
"type": "author",
"name": ""
},
"valueDataRequirement": {
"type": ""
},
"valueExpression": {
"language": ""
},
"valueParameterDefinition": {
"use": "in",
"type": ""
},
"valueRelatedArtifact": {
"type": "documentation"
},
"valueTriggerDefinition": {
"type": "named-event"
},
"valueUsageContext": {
"code": {},
"valueCodeableConcept": {},
"valueQuantity": {},
"valueRange": {},
"valueReference": {}
},
"valueDosage": {},
"valueMeta": {}
}
],
"resourceType": "Task"
}Metadata
Metadata
Assignees
Labels
No labels