FirelyTeam / firely-net-sdk

The official Firely .NET SDK for HL7 FHIR
Other
829 stars 345 forks source link

Difference in behaviour for ITypedElement.Value for Attachment.Size #2368

Closed ewoutkramer closed 7 months ago

ewoutkramer commented 1 year ago

Since SDK 5.0 the datatype of Attachment.Size is Integer64, where it was UnsignedInt before. This is coded with the use of a [DeclaredType] attribute, since this change happened in R5.

The implementation of ITypedElement on POCO will show the correct type in the InstanceType member, but will always use the underlying .NET type (which is a long) for the Value, regardless of whether we are dealing with R4 or R5.

The implementation of ITypedElement on SourceNode has no underlying POCO model (it gets its metadata from StructureDefinition), and it will use int for R4 and long for R5.

Of course, ITypedElement should behave the same, regardless of the implementation.

It is not clear what the desired behaviour is however. Certainly, the ITypedElement on SourceNode is correct, but it is also means the user has to be aware of the version of FHIR that the ITypedelement is using to read the property. Which is not the case for the POCO-based implementation.

ewoutkramer commented 1 year ago

I think the ITypedElement implementation on SourceNode is correct, and the one on POCO should behave the same.

This will be a breaking change, however, so I'll flag it as such and take it off the current sprint.

mmsmits commented 7 months ago

We don't think this is a priority