Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
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,7 @@ 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.getMessage().contains("null")) ? e.getMessage() : "Invalid JSON", null);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tweaked the condition, but this suggestion was needlessly verbose/messy.

}
}

Expand All @@ -101,15 +100,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());
Comment thread
MatthewPopat-NHS marked this conversation as resolved.
}

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

return Arrays.asList(inputResource);
Expand Down
39 changes: 38 additions & 1 deletion src/test/resources/results/searchSet.json
Original file line number Diff line number Diff line change
Expand Up @@ -2391,6 +2391,43 @@
"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]"
]
}]
Comment thread
Orkastrated marked this conversation as resolved.
Outdated
}
Loading