Stream: hapi
Topic: Challenges with _count and total in HAPI
Keith Boone (Nov 07 2019 at 21:21):
I'm working on pagination in my server (not using PaginationProvider), returning a Bundle. It appears that HAPI is rewriting the bundle I return and changing the value of Total to -1 (one of my test cases is for _count=-1, which seems to be related). I suspect I need to return an IBundleProvider or something, but thought I would mention the weird behavior.
Keith Boone (Nov 07 2019 at 21:23):
Issue appears to be in BaseMethodBinding.toResourceList() method.
Keith Boone (Nov 07 2019 at 21:53):
Tracked it back to BaseResourceReturningMethodBinding. doInvokeServer(IRestfulServer<?> theServer, RequestDetails theRequest)
where:
Integer count = RestfulServerUtils.extractCountParameter(theRequest);
...
And then:
bundleFactory.addRootPropertiesToBundle(null, theRequest.getFhirServerBase(), linkSelf, null, null, count, getResponseBundleType(), lastUpdated);
BUT: count is clearly not theTotalResults, and in fact, there's really no way to know what that value SHOULD be based on the response unless Bundle.total is populated.
I'll log a bug for this, and see what I can do to work around it.
Keith Boone (Nov 07 2019 at 21:59):
https://github.com/jamesagnew/hapi-fhir/issues/1585
Last updated: Apr 12 2022 at 19:14 UTC