Stream: implementers
Topic: Invalid values in json ignored quietly
badal (Nov 03 2017 at 14:20):
In "invalidkeyvalue_ProcedureRequest.json" file contains invalid key value.
I run CURL command on invalidkeyvalue_ProcedureRequest.json. I had expected an error, but i got this response:
curl -X POST https://fhir.dstu2.safetylabs.org/api/smartdstu2/open/ProcedureRequest -H 'Content-type: application/json+fhir' --data @ invalidkeyvalue_ProcedureRequest.json
{
"resourceType":"OperationOutcome",
"text":{
"status":"generated",
"div":"<div xmlns=\"http://www.w3.org/1999/xhtml\ <http://www.w3.org/1999/xhtml/> "><h1>Operation Outcome</h1><table border=\"0\"><tr><td style=\"font-weight: bold;\">information</td><td>[]</td><td><pre>Successfully created resource "ProcedureRequest/7550/_history/1" in 11ms</pre></td>\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t</tr>\n\t\t</table>\n\t</div>"
},
"issue":[
{
"severity":"information",
"code":"informational",
"diagnostics":"Successfully created resource \"ProcedureRequest/7550/_history/1\" in 11ms"
}
]
Run curl command for getting the updated object.
curl -X GET https://fhir.dstu2.safetylabs.org/api/smartdstu2/open/ProcedureRequest/7550
{
"resourceType":"ProcedureRequest",
"id":"7550",
"meta":{
"versionId":"1",
"lastUpdated":"2017-11-03T13:20:58.000+00:00"
},
"text":{
"status":"generated"
},
"subject":{
"reference":"Patient/SL88812358"
},
"code":{
"coding":[
{
"code":"303654007",
"display":"Computed X ray"
}
]
},
"performer":{
"reference":"Practitioner/COREPRACTITIONER1"
}
Question 1: Why don't we get any error while running CURL command when there are invalid key/value pair (the once not defined in the FHIR resource spec) ?
Question 2: If I do not get an error I expected invalid key value from the JSON in my search response?
invalide_key_invalide_valueProcedureRequest.json
Grahame Grieve (Nov 03 2017 at 20:33):
you should get an error from the reference servers which validate the content on submission. (e.g. test.fhir.org or hapi.fhir.org). But servers are not required to validate content
Last updated: Apr 12 2022 at 19:14 UTC