Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polymorphism of Task.input.value[x] incorrect? #3

Open
reinkrul opened this issue Aug 31, 2024 · 1 comment · May be fixed by #4
Open

Polymorphism of Task.input.value[x] incorrect? #3

reinkrul opened this issue Aug 31, 2024 · 1 comment · May be fixed by #4

Comments

@reinkrul
Copy link

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"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
@reinkrul and others