Skip to content
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

3-way merge of cardinality of an element #1990

Merged

Conversation

marcovisserFurore
Copy link
Member

Description

In PR #1826 we introduced a bug in existing functionality. We resolved that now by a 3-way merge of the cardinality of

  • snapshot
  • differential
  • external profile type

The most constrained value will win. Let's say we have the following cardinalities on an element:

  • snapshot: 0..*
  • differential: 1..*
  • external profile type (like an extension): 1..1

Then the result cardinality of the element would be: 1..1

This behavior is also applied to the "normal" merge of Min: in the past the Min value of the differential was copied to the snapshot (when it exists). Now both Min values (snap and diff) are compared first, and the highest value wins.

Related issues

Resolves #1981.

Testing

  • SnapshotGeneratorTest2.TestMinMax
  • SnapshotGeneratorTest2.CardinalityOfExtension

FirelyTeam Checklist

  • Update the title of the PR to be succinct and less than 50 characters
  • Mark the PR with the label breaking change when this PR introduces breaking changes

@@ -278,9 +308,9 @@ internal FhirString mergeMax(FhirString snap, FhirString diff)
return snap;
}

private FhirString deepCopyAndRaiseOnConstraint(FhirString elt)
private T deepCopyAndRaiseOnConstraint<T>(T elt) where T : PrimitiveType
Copy link
Member

Choose a reason for hiding this comment

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

Nice!

@marcovisserFurore marcovisserFurore merged commit e3610b1 into develop-stu3 Feb 24, 2022
@marcovisserFurore marcovisserFurore deleted the feature/1981-max-cardinality-extensions-stu3 branch February 24, 2022 13:20
@Rob5045 Rob5045 mentioned this pull request Mar 2, 2022
marcovisserFurore added a commit that referenced this pull request Mar 2, 2022
@Rob5045 Rob5045 mentioned this pull request Mar 3, 2022
marcovisserFurore added a commit that referenced this pull request Mar 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Snapshot generator calculates invalid max cardinality for extensions
3 participants