Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,24 @@ public async Task<ICapabilityStatementBuilder> SyncProfilesAsync(CancellationTok

public ITypedElement Build()
{
// Remove resource entries with no interactions to ensure FHIR conformance.
// In STU3, CapabilityStatement.rest.resource.interaction has min cardinality 1,
// so resources without interactions (e.g. Parameters) must be excluded.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@EXPEkesheth this could technically be called a breaking change. I think it is a correct change, and it should be non-impactful as anything removed in this filter would have no request types. What are your thoughts?

if (_modelInfoProvider.Version == FhirSpecification.Stu3)
{
foreach (var restComponent in _statement.Rest)
{
var emptyResources = restComponent.Resource
.Where(r => r.Interaction == null || r.Interaction.Count == 0)
.ToList();

foreach (var resource in emptyResources)
{
restComponent.Resource.Remove(resource);
}
}
}

// To build a CapabilityStatement we use a custom JsonConverter that serializes
// the ListedCapabilityStatement into a CapabilityStatement poco
var json = JsonConvert.SerializeObject(_statement, new JsonSerializerSettings
Expand Down