Skip to content

Commit

Permalink
Revert "Merge pull request #2754 from FirelyTeam/2586-snapshotgenerat…
Browse files Browse the repository at this point in the history
…or-keep-snapshot-when-differential-is-missing"

This reverts commit 1cfaad6, reversing
changes made to 3267f75.
  • Loading branch information
mmsmits committed May 1, 2024
1 parent 5874ad6 commit 9b726eb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,14 @@ private static IAsyncResourceResolver verifySource(IAsyncResourceResolver resolv
/// <param name="structure">A <see cref="StructureDefinition"/> instance.</param>
public async T.Task UpdateAsync(StructureDefinition structure)
{
var result = await GenerateAsync(structure).ConfigureAwait(false);

if (result == null && structure.Snapshot?.Element != null) return;

structure.Snapshot = new StructureDefinition.SnapshotComponent { Element = result };
structure.Snapshot.SetCreatedBySnapshotGenerator();
structure.Snapshot = new StructureDefinition.SnapshotComponent()
{
Element = await GenerateAsync(structure).ConfigureAwait(false)
};
structure.Snapshot.SetCreatedBySnapshotGenerator();

// [WMR 20170209] TODO: also merge global StructureDefinition.Mapping components
// structure.Mappings = ElementDefnMerger.Merge(...)
// [WMR 20170209] TODO: also merge global StructureDefinition.Mapping components
// structure.Mappings = ElementDefnMerger.Merge(...)
}

/// <inheritdoc cref="UpdateAsync(StructureDefinition)"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3194,42 +3194,6 @@ public async T.Task FindComplexTestExtensions()
}
};

private static StructureDefinition LogicalModelWithoutDiff => new()
{
Name = "MyLogicalModel",
Url = "http://example.org/fhir/StructureDefinition/MyLogicalModel",
Type = "http://foo.org/bar",
Derivation = StructureDefinition.TypeDerivationRule.Constraint,
BaseDefinition = "http://hl7.org/fhir/StructureDefinition/Base",
Kind = StructureDefinition.StructureDefinitionKind.Logical,
Snapshot = new()
{
Element = new()
{
new()
{
ElementId = "logicalmodel",
Path = "logicalmodel",
Short = "root"

},
new()
{
ElementId = "logicalmodel.Identifier",
Path = "logicalmodel.Identifier",
Short = "Identifier",
Min = 1,
Max = "*",
Type = new()
{
new() {Code = "Identifier"}
}
},
}
}

};

[Conditional("DEBUG")]
private void dumpElements(IEnumerable<ElementDefinition> elements, string header = null) => dumpElements(elements.ToList(), header);

Expand Down Expand Up @@ -3332,23 +3296,6 @@ public async T.Task TestMissingDifferential()
expanded.Snapshot.Element.Dump();
}

[TestMethod]
public async T.Task TestMissingDifferentialLogicalModel()
{
// Create a profile without a differential
var profile = LogicalModelWithoutDiff;

var resolver = new InMemoryResourceResolver(profile);
var multiResolver = new MultiResolver(_testResolver, resolver);
_generator = new SnapshotGenerator(multiResolver, _settings);

var (_, expanded) = await generateSnapshotAndCompare(profile);
Assert.IsNotNull(expanded);
Assert.IsTrue(expanded.HasSnapshot);

expanded.Snapshot.Element.Dump();
}

[TestMethod]
public async T.Task TestUnresolvedBaseProfile()
{
Expand Down

0 comments on commit 9b726eb

Please sign in to comment.