Skip to content

Breaking changes in 4.0

Ewout Kramer edited this page Jan 4, 2022 · 11 revisions

Changes in classes

  • The methods on the extension class ObjectListExtensions are made obsolete.
  • Code<T>.Value will throw instead of returning null when ObjectValue contains an invalid enum member.
  • Removed the (dead) code for setting a resolver on the ValidationContext using the SetResolver() and Resolver() extension methods.
  • BooleanPattern attribute removed. Since FhirBoolean.Value is a bool, there is nothing to validate (it was dead code and unused already)
  • DotnetAttributeValidation.BuildContext() made private, since it was never meant to be called directly (just a .NET4.0 shim)
  • DotnetAttributeValidation.BuildResult() has been removed, as it was never meant to be called directly
  • Base64Binary.IsValidValue() now validates whether the data is actually valid base64 data, instead of just running the HL7 supplied pattern.
  • Canonical.IsValidValue() now uses the same validation as FhirUri.IsValidValue() (it's a subclass of it).
  • FhirUrl.IsValidValue() now checks whether absolute urls actually start with "http" or "https:"
  • Date.IsValidValue() now goes beyond the pattern by actually asserting the validity of the date.
  • FhirDateTime.IsValidValue() now goes beyond the pattern by actually asserting the validity of the date/date.
  • Time.IsValidValue() now goes beyond the pattern by actually asserting the validity of the time
  • FhirDecimal.IsValidValue() goes beyond the pattern by actually asserting the validity of the decimal
  • Removed our own version of IValidatableObject (since it was exactly the same as the one in System.ComponentModel.DataAnnotations.
  • Removed the InvokeIValidatableObject attribute, since this is exactly what the standard .NET DataAnnotations will do when one calls Validator.ValidateObject(), so this is no longer necessary.
  • Code is now validated using a CodePatternAttribute, this corrects an omission.
  • ReflectionClass removed (never made production ready or used, included by accident)
  • PropertyMapping.TryCreate() now requires a ClassMapping parameter for the declaring type.
  • DotNetAttributeValidation.Validate/TryValidate now are more strict and take a Base as the first parameter. Also, these have been changed into extension methods.

Restructuring ElementDefinition extension methods

A set of useful extension methods on ElementDefinition (and components) had become scattered around the source code in the past years. We have concentrated them into a single class ElementDefinitionExtensions:

  • ElementDefinitionNavigatorExtensions has its ElementDefinition-related extension methods moved to ElementDefinitionExtensions.
  • TypeRefExtensions has its ElementDefinition-related extension methods moved to ElementDefinitionExtensions.
  • ProfileNavigationExtensions has its ElementDefinition-related extension methods moved to ElementDefinitionExtensions.
  • TypeRefExtensions.IsChoice(this ElementDefinition) has been renamed to HasChoices()
  • ElementDefinitionNavigatorExtensions.IsSlicing(this ElementDefinitionNavigator) has been removed.
  • ElementDefinition.ChoiceTypes() has been removed.

Classes moved to Common assembly

Clone this wiki locally