Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .trivyignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ CVE-2021-35515
CVE-2021-35516
CVE-2021-35517
CVE-2021-36090
CVE-2026-33180
# upgrading fasterxml-core to fixed version 2.21.1 appears to not
# be compatible with 2.19.2 of fasterxml-annotations
GHSA-72hv-8253-57qq
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.r4.model.Bundle;
import org.hl7.fhir.r4.model.OperationOutcome;
import org.hl7.fhir.r4.model.ResourceType;
import org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent;

import ca.uhn.fhir.context.FhirContext;
Expand Down Expand Up @@ -80,7 +79,8 @@ public OperationOutcome parseAndValidateResource(String input) {
| DataFormatException e) {
log.error(e.toString());
return OperationOutcomeUtils
.createOperationOutcome(e.getMessage() != null ? e.getMessage() : "Invalid JSON", null);
.createOperationOutcome((e.getMessage() != null && !(e instanceof NullPointerException))
? e.getMessage() : "Invalid JSON", null);
}
}

Expand All @@ -101,15 +101,10 @@ private List<IBaseResource> getResourcesToValidate(IBaseResource inputResource)
if (inputResource instanceof Bundle _inputResource && (_inputResource.getType() == Bundle.BundleType.SEARCHSET)) {
List<IBaseResource> bundleResources = new ArrayList<>();
for (Bundle.BundleEntryComponent entry : ((Bundle) inputResource).getEntry()) {
if (entry.getResource().fhirType().equals("Bundle")) {
bundleResources.add(entry.getResource());
}
bundleResources.add(entry.getResource());
}

if (bundleResources.stream()
.allMatch(resource -> ((Bundle) resource).getResourceType() == ResourceType.Bundle)) {
return bundleResources;
}
return bundleResources;
}

return Arrays.asList(inputResource);
Expand Down
38 changes: 38 additions & 0 deletions src/test/resources/results/searchSet.json
Original file line number Diff line number Diff line change
Expand Up @@ -2391,6 +2391,44 @@
"Bundle.entry[4].resource/*Organization/154dcc4a-0006-4272-9758-9dcb8d95ce8b*/",
"Line[1] Col[3089]"
]
},
{
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/operationoutcome-issue-line",
"valueInteger": 1
},
{
"url": "http://hl7.org/fhir/StructureDefinition/operationoutcome-issue-col",
"valueInteger": 496
}
],
"severity": "warning",
"code": "processing",
"diagnostics": "Constraint failed: dom-6: 'A resource should have narrative for robust management' (defined in http://hl7.org/fhir/StructureDefinition/DomainResource) (Best Practice Recommendation)",
"location": [
"OperationOutcome",
"Line[1] Col[496]"
]
},
{
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/operationoutcome-issue-line",
"valueInteger": 1
},
{
"url": "http://hl7.org/fhir/StructureDefinition/operationoutcome-issue-col",
"valueInteger": 496
}
],
"severity": "warning",
"code": "processing",
"diagnostics": "Constraint failed: dom-6: 'A resource should have narrative for robust management' (defined in http://hl7.org/fhir/StructureDefinition/DomainResource) (Best Practice Recommendation)",
"location": [
"OperationOutcome",
"Line[1] Col[496]"
]
}
]
}
Loading