-
Notifications
You must be signed in to change notification settings - Fork 157
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
issues 3242 and 3265 - scope search-system and search-history for fhirVersion #3268
Conversation
This changeset adds a JAX-RS RequestFilter that sets a requestContext property, "com.ibm.fhir.server.fhirVersion" with the following order of precedence: 1. "4.3" from the acceptableMediaTypes 2. "4.0" from the acceptableMediaTypes 3. whatever is configured in the fhirServer/core/defaultFhirVersion config property 4. "4.0" Additionally, I updated the Capabilities resource to use the fhirVersion from the request context instead of processing the Accept header itself. Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>
fhir-config/src/main/java/com/ibm/fhir/config/FHIRConfigHelper.java
Outdated
Show resolved
Hide resolved
fhir-config/src/main/java/com/ibm/fhir/config/ResourcesConfigAdapter.java
Show resolved
Hide resolved
fhir-config/src/main/java/com/ibm/fhir/config/ResourcesConfigAdapter.java
Outdated
Show resolved
Hide resolved
fhir-core/src/main/java/com/ibm/fhir/core/FHIRVersionParam.java
Outdated
Show resolved
Hide resolved
fhir-core/src/main/java/com/ibm/fhir/core/util/ResourceTypeHelper.java
Outdated
Show resolved
Hide resolved
fhir-core/src/test/java/com/ibm/fhir/core/util/test/ResourceTypeHelperTest.java
Show resolved
Hide resolved
Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>
1. introduce enums and utilities for working with resource type names and fhirVersion values ('4.0' and '4.3') 2. use those to provide a better abstraction for working with the fhir-server-config `fhirServer/resources` property group (ResourcesConfigAdapter) 3. move fhirVersion MIME-type parameter processing into a new JAX-RS RequestFilter FHIRVersionRequestFilter and update tests accordingly 4. update FHIRPersistenceUtil.parseSystemHistoryParameters to take into account the requested fhirVersion and scope the HistoryContext appropriately 5. update SearchUtil.parseQueryParameters to take into account the requested fhirVersion and scope the SearchContext appropriately Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>
1. add the FHIRVersionParam to the OperationContext 2. use that with a ResourcesConfigAdapter to get the list of applicable resource types in EverythingOperation.getDefaultIncludedResourceTypes Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>
mostly javadoc updates and a couple minor refactorings Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>
Previously I was only looking in the Accept header. Now, for PUT and POST requests, I'll check the Content-Type header first. Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>
fhir-persistence/src/main/java/com/ibm/fhir/persistence/util/FHIRPersistenceUtil.java
Show resolved
Hide resolved
|
||
assertTrue(historyContext.getResourceTypes().isEmpty(), historyContext.getResourceTypes().toString()); | ||
} finally { | ||
FHIRRequestContext.get().setTenantId(originalTenantId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think we should use remove (or at least clear the tenantId here...all tests should be forced to establish their own tenant in the context, so I don't think setting the originalTenantId should be necessary (unless there's a specific use case I'm not thinking of here.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes. i'm not sure how important it is, but i think calling FHIRRequestContext.remove() after each test is probably a good pattern to help prevent us from more errors related to the thread-local
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe as part of #3283 ?
In the latest draft of R4B, these resource types have a new choice type for the subject field. This means that all R4 instances will still be valid in R4B, but not vice-versa. Instead of coding up special support where R4 clients can PUT/POST these resource instances, but not read them, we chose to treat them like backwards-compatible resources and document the incompatibility concern for R4 clients. Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>
fhir-search/src/main/java/com/ibm/fhir/search/util/SearchUtil.java
Outdated
Show resolved
Hide resolved
fhir-server/src/main/java/com/ibm/fhir/server/resources/Capabilities.java
Outdated
Show resolved
Hide resolved
fhir-server/src/main/java/com/ibm/fhir/server/resources/FHIRResource.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just some minor comments
1. resolve TODO in Capabilities (replace getSupportedResourceTypes with ResourcesConfigAdapter) 2. fix stale javadoc for SearchUtil.useStoredCompartmentParam Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>
the latest runs failed due to an unrelated issue in our CI that has already been fixed in main, so I'm gonna go ahead and merge this into |
and fhirVersion values ('4.0' and '4.3') in fhir-core (we had similar in fhir-model,
but those weren't available to fhir-config and the added complexity of the FHIR
model makes them a tad harder to work with)
fhir-server-config
fhirServer/resources
property group(ResourcesConfigAdapter)
RequestFilter FHIRVersionRequestFilter and update the JAX-RS resources and
tests accordingly
account the requested fhirVersion and scope the HistoryContext
appropriately
requested fhirVersion and scope the SearchContext appropriately
resource types in EverythingOperation.getDefaultIncludedResourceTypes
also included the small removal for #3265