You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Generating a Bundle, including a Binary wrapped in an Entry, does not pass Validation. The Validation believes that Content should not be null. This requirement was true in R4, but should no longer apply in R5. Deserializing the message works correctly, but bundle.Validate(recurse: true) throws the following exception:
System.ComponentModel.DataAnnotations.ValidationException: Element 'ContentElement' with minimum cardinality 1 cannot be null. At Bundle.Entry.Resource.ContentElement, line , position
at System.ComponentModel.DataAnnotations.Validator.ValidationError.ThrowValidationException()
at System.ComponentModel.DataAnnotations.Validator.ValidateObject(Object instance, ValidationContext validationContext, Boolean validateAllProperties)
at Hl7.Fhir.Validation.DotNetAttributeValidation.Validate(Object value, Boolean recurse, NarrativeValidationKind narrativeValidation)
at Hl7.Fhir.Validation.DotNetAttributeValidation.Validate(Base value, Boolean recurse, NarrativeValidationKind narrativeValidation)
To Reproduce
using Hl7.Fhir.Model;using Hl7.Fhir.Serialization;using Hl7.Fhir.Validation;using System.Text.Json;
/// <summary>/// The actual content. Note: Element is replaced by 'Binary.data' since R4. Do not use this element 'content' with R4 and newer releases./// </summary>[FhirElement("content", Order=70)][NotMapped(Since=FhirRelease.R4)][Cardinality(Min=1,Max=1)][DataMember]public Hl7.Fhir.Model.Base64Binary ContentElement
{get{return _ContentElement;}set{ _ContentElement = value; OnPropertyChanged("ContentElement");}}
Though ContentElement has been replaced since R4, Hl7.Fhir.Validation still appears to be validating its Cardinality attribute.
Maybe add Since to the Cardinality attribute too? Or is that a hack for the deeper problem that only one of the two properties should be considered for validation (and deserialization) at any moment?
Describe the bug
Generating a Bundle, including a Binary wrapped in an Entry, does not pass Validation. The Validation believes that Content should not be null. This requirement was true in R4, but should no longer apply in R5. Deserializing the message works correctly, but
bundle.Validate(recurse: true)
throws the following exception:To Reproduce
Expected behavior
.Validate(recurse: true)
should not return any validation error.Version used:
<PackageReference Include="Hl7.Fhir.R5" Version="5.8.1" />
The text was updated successfully, but these errors were encountered: