Skip to content

Breaking changes in 4.0

Marco Visser edited this page May 6, 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.
  • LegacyFhirClient is made obsolete and will be removed in the new major release.
  • Method ValidateCode of ITerminologyService is removed and all classes that implement this interface the method ValidateCode is made obsolete.

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.

Validator behavior

  • The ConstraintBestPractices setting in ValidationSettings with values of Ignore, Enable, and Disable has been replaced by ConstraintBestPracticesSeverity with values of Warning and Error. This means that constraints marked as "best practice" in the spec aren't being ignored by default anymore, but now result in a warning when they are not met.
  • A new setting has been added called 'ConstraintsToIgnore' which is a string array, including the keys of the constraints for the validator to ignore. By default the following constraints are ignored: dom-6 and rng-2. The user can obviously overwrite this list.

Model

The FhirAttribite IsModifier has been added to Poco elements according to the FHIR specification. _summary=true is now depedent on IsModifier or InSummary. The attribute InSummary=true is removed for the following pocos elements:

Classes moved to Common assembly

The following classes/interfaces have been moved to the common assembly Hl7.Fhir.Support.Poco:

  • FhirOperationException
  • ITerminologyService
  • ResourceReferenceExtensions
  • SearchParamsExtensions
  • TokenExtensions
  • IArtifactSource
Clone this wiki locally