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
The default parser errors when parsing StructureDefinition-integer64.json from the core R5 package (version 5.0.0). Specifically, it is trying to parse snapshot.element[3].minValueInteger64 as a Date instead of an Integer64.
The exception it throws is listed below (in screenshots).
Expected behavior
Successful parsing of the resource.
Screenshots
Hl7.Fhir.Serialization.DeserializationFailedException: 'One or more errors occurred. (Json string '-9223372036854775808' cannot be parsed as a Date, because it should be a Json number. At StructureDefinition.snapshot.element[3].minValue, line 191, position 52) (Json string '9223372036854775807' cannot be parsed as a Date, because it should be a Json number. At StructureDefinition.snapshot.element[3].maxValue, line 192, position 51) (Json string '-9223372036854775808' cannot be parsed as a Date, because it should be a Json number. At StructureDefinition.differential.element[1].minValue, line 234, position 52) (Json string '9223372036854775807' cannot be parsed as a Date, because it should be a Json number. At StructureDefinition.differential.element[1].maxValue, line 235, position 51)'
(emphasis mine)
Version used:
FHIR Version: R5
Version: 5.5.1 and develop branch current as of Feb 6 (commit 5113eef).
Additional context
The issue appears to be in the deserializePropertyValueInto function in ...\src\Hl7.Fhir.Base\Serialization\BaseFhirJsonPocoDeserializer.cs. Specifically, the line that sets the fhirType that will be used in the next deserialize call in the nest when deserializing elements that are choice types with primitives. I tested both of the following changes and they both correct the issue. However, there are a lot of failing tests on my system (I believe unrelated to the current issue) and could not tell the impact of the changes.
Option 1:
Change:
var fhirType = propertyMapping.FhirType.FirstOrDefault();
to
varfhirType= propertyValueMapping.NativeType;
Since we already know that the property mapping is to a primitive type, simply use the type from that mapping. I am not sure I have all of the context correct to apply as a one-liner, so I also tested the following.
Option 2:
Change (same line):
var fhirType = propertyMapping.FhirType.FirstOrDefault();
This option has a little performance hit but specifically checks to see if the property mapping has the desired type in it. Again, I am not sure if this check is necessary or not at this point, but figured it was easier if I provided both.
The text was updated successfully, but these errors were encountered:
Describe the bug
The default parser errors when parsing
StructureDefinition-integer64.json
from the core R5 package (version 5.0.0). Specifically, it is trying to parsesnapshot.element[3].minValueInteger64
as aDate
instead of anInteger64
.The exception it throws is listed below (in screenshots).
To Reproduce
Steps to reproduce the behavior:
Assuming the definition is present in TestData:
Expected behavior
Successful parsing of the resource.
Screenshots
(emphasis mine)
Version used:
develop
branch current as of Feb 6 (commit 5113eef).Additional context
The issue appears to be in the
deserializePropertyValueInto
function in...\src\Hl7.Fhir.Base\Serialization\BaseFhirJsonPocoDeserializer.cs
. Specifically, the line that sets thefhirType
that will be used in the next deserialize call in the nest when deserializing elements that are choice types with primitives. I tested both of the following changes and they both correct the issue. However, there are a lot of failing tests on my system (I believe unrelated to the current issue) and could not tell the impact of the changes.Option 1:
Change:
to
Since we already know that the property mapping is to a primitive type, simply use the type from that mapping. I am not sure I have all of the context correct to apply as a one-liner, so I also tested the following.
Option 2:
Change (same line):
to
This option has a little performance hit but specifically checks to see if the property mapping has the desired type in it. Again, I am not sure if this check is necessary or not at this point, but figured it was easier if I provided both.
The text was updated successfully, but these errors were encountered: