smart-on-fhir / Swift-SMART

Swift SMART on FHIR framework for iOS and OS X
Other
134 stars 47 forks source link

Error when using _summary=count #31

Open MischaRo opened 4 years ago

MischaRo commented 4 years ago

I have a Server running with a couple of images on it. When I run the following code with postman:

....Media?modality:text=Sonstige&_summary=count

I am shown the amount of images I have with the modality:text=Sonstige

{
  "resourceType": "Bundle",
  "id": "8e41e384-6c1a-4da2-919f-b6b4622a8b7e",
  "meta": {
    "lastUpdated": "2020-03-14T12:37:26.558+00:00",
    "tag": [
      {
        "system": "http://terminology.hl7.org/CodeSystem/v3-ObservationValue",
        "code": "SUBSETTED",
        "display": "Resource encoded in summary mode"
      }
    ]
  },
  "total": 2
}

But when I try to replicate the same call in smart-swift, I get an Error in my client application. I am using this call: let search = Media.search(["modality":["$text": type],"_summary": "count"]) and I get the following Error in the Xcode Debugger:

ERROR

Optional(Failed to validate resource: Bundle.type: mandatory property “type” is missing)

When I call: print(search.construct()) the generated call is the same I used in postman:

Media?_summary=count&modality:text=Sonstige

To me, it looks like swift-SMART can't handle the server response, because the returned Bundle does not have a resource type, but this type of search does in fact not have one. Is there an other way to use the _summary - search modifier in swift-SMART?