hapi-fhir icon indicating copy to clipboard operation
hapi-fhir copied to clipboard

3986: Remove validation of max parameter lastn and add tests

Open gijsgroenewegen opened this issue 1 year ago • 1 comments

Issue Closes #3986

Problem The max parameter supplied to the $lastn operation in every FHIR version causes the error: HAPI-0524: Unknown search parameter \"max\" for resource type \"Observation\". Valid search parameters for this search are: [_content, _id, ...].

The reason for this is that this function is defined in the Observation base provider, meaning that every implementing provider has the resource type Observation defined. The function translateRawParameters uses this resource type to check for allowed parameters. The $lastn specific parameter max is not one of the normally defined parameters for the Observation resource in any FHIR version.

Solution I have investigated multiple solution areas to this problem. To avoid any large impact on the $lastn implementation or its other (overlapping with the Observation resource) parameters, I have opted to remove the max parameter from the list of raw parameters to avoid the error mentioned above.

I would love to know your opinions on the solution and if any changes are required.

gijsgroenewegen avatar Feb 24 '24 13:02 gijsgroenewegen

Hi, heads up that I saw that a contribution is mentioned in the changelog that I based my changelog on:

---
type: fix
issue: 3761
title: "Fixed behaviour of the `_list` query parameter. Now it returns exclusively resources that are members of the given list. Thanks to Jens Villadsen (@jkiddo) for the contribution!"

I added one to my changelog as well, assuming this is common practice.

I did not add myself as a developer to the pom.xml, although I saw the mentioned contributor there as well. If this is required when contributing, let me know. Then I will update the pull request.

gijsgroenewegen avatar Feb 24 '24 13:02 gijsgroenewegen

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 83.42%. Comparing base (497b9f2) to head (6ace847). Report is 53 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #5737      +/-   ##
============================================
+ Coverage     83.39%   83.42%   +0.02%     
- Complexity    26927    27013      +86     
============================================
  Files          1681     1688       +7     
  Lines        103965   104253     +288     
  Branches      13189    13224      +35     
============================================
+ Hits          86702    86972     +270     
- Misses        11613    11622       +9     
- Partials       5650     5659       +9     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar May 02 '24 16:05 codecov[bot]