-
Notifications
You must be signed in to change notification settings - Fork 342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JsonSerializerOptions().ForFhir ... .Deserialize<Bundle>() Throws in 5.3.0 #2604
Comments
For some reason, I can't upload files to github... so sharing the error messages here. {
"Exceptions": [
{
"IssueSeverity": 0,
"IssueType": 1,
"BaseErrorMessage": "Unknown type 'Location' found in 'resourceType' property.",
"LineNumber": 7,
"Position": 20,
"InstancePath": "Bundle.entry[0].resource",
"ErrorCode": "JSON116",
"Message": "Unknown type 'Location' found in 'resourceType' property. At Bundle.entry[0].resource, line 7, position 20",
"Data": {},
"InnerException": null,
"HelpLink": null,
"Source": null,
"HResult": -2146233088,
"StackTrace": null
},
{
"IssueSeverity": 0,
"IssueType": 1,
"BaseErrorMessage": "Unknown type 'Organization' found in 'resourceType' property.",
"LineNumber": 43,
"Position": 20,
"InstancePath": "Bundle.entry[1].resource",
"ErrorCode": "JSON116",
"Message": "Unknown type 'Organization' found in 'resourceType' property. At Bundle.entry[1].resource, line 43, position 20",
"Data": {},
"InnerException": null,
"HelpLink": null,
"Source": null,
"HResult": -2146233088,
"StackTrace": null
},
{
"IssueSeverity": 0,
"IssueType": 1,
"BaseErrorMessage": "Unknown type 'Organization' found in 'resourceType' property.",
"LineNumber": 60,
"Position": 20,
"InstancePath": "Bundle.entry[2].resource",
"ErrorCode": "JSON116",
"Message": "Unknown type 'Organization' found in 'resourceType' property. At Bundle.entry[2].resource, line 60, position 20",
"Data": {},
"InnerException": null,
"HelpLink": null,
"Source": null,
"HResult": -2146233088,
"StackTrace": null
},
{
"IssueSeverity": 0,
"IssueType": 1,
"BaseErrorMessage": "Unknown type 'Organization' found in 'resourceType' property.",
"LineNumber": 77,
"Position": 20,
"InstancePath": "Bundle.entry[3].resource",
"ErrorCode": "JSON116",
"Message": "Unknown type 'Organization' found in 'resourceType' property. At Bundle.entry[3].resource, line 77, position 20",
"Data": {},
"InnerException": null,
"HelpLink": null,
"Source": null,
"HResult": -2146233088,
"StackTrace": null
},
{
"IssueSeverity": 0,
"IssueType": 1,
"BaseErrorMessage": "Unknown type 'HealthcareService' found in 'resourceType' property.",
"LineNumber": 94,
"Position": 20,
"InstancePath": "Bundle.entry[4].resource",
"ErrorCode": "JSON116",
"Message": "Unknown type 'HealthcareService' found in 'resourceType' property. At Bundle.entry[4].resource, line 94, position 20",
"Data": {},
"InnerException": null,
"HelpLink": null,
"Source": null,
"HResult": -2146233088,
"StackTrace": null
},
{
"IssueSeverity": 0,
"IssueType": 1,
"BaseErrorMessage": "Unknown type 'Practitioner' found in 'resourceType' property.",
"LineNumber": 187,
"Position": 20,
"InstancePath": "Bundle.entry[5].resource",
"ErrorCode": "JSON116",
"Message": "Unknown type 'Practitioner' found in 'resourceType' property. At Bundle.entry[5].resource, line 187, position 20",
"Data": {},
"InnerException": null,
"HelpLink": null,
"Source": null,
"HResult": -2146233088,
"StackTrace": null
},
{
"IssueSeverity": 0,
"IssueType": 1,
"BaseErrorMessage": "Unknown type 'PractitionerRole' found in 'resourceType' property.",
"LineNumber": 409,
"Position": 20,
"InstancePath": "Bundle.entry[6].resource",
"ErrorCode": "JSON116",
"Message": "Unknown type 'PractitionerRole' found in 'resourceType' property. At Bundle.entry[6].resource, line 409, position 20",
"Data": {},
"InnerException": null,
"HelpLink": null,
"Source": null,
"HResult": -2146233088,
"StackTrace": null
}
],
"Message": "One or more errors occurred. (Unknown type 'Location' found in 'resourceType' property. At Bundle.entry[0].resource, line 7, position 20) (Unknown type 'Organization' found in 'resourceType' property. At Bundle.entry[1].resource, line 43, position 20) (Unknown type 'Organization' found in 'resourceType' property. At Bundle.entry[2].resource, line 60, position 20) (Unknown type 'Organization' found in 'resourceType' property. At Bundle.entry[3].resource, line 77, position 20) (Unknown type 'HealthcareService' found in 'resourceType' property. At Bundle.entry[4].resource, line 94, position 20) (Unknown type 'Practitioner' found in 'resourceType' property. At Bundle.entry[5].resource, line 187, position 20) (Unknown type 'PractitionerRole' found in 'resourceType' property. At Bundle.entry[6].resource, line 409, position 20)"
} |
I think I have this figured out. Instead of // works!
var bundle = new Bundle();
var options = new JsonSerializerOptions().ForFhir(typeof(Practitioner).Assembly);
bundle = JsonSerializer.Deserialize<Bundle>(jsonString, options); |
Exactly! Even better is to use the var jsonInput = "{.....}";
var options = new JsonSerializerOptions().ForFhir(ModelInfo.ModelInspector);
var patient = JsonSerializer.Deserialize<Bundle>(jsonInput, options);
With this answer I close the issue. |
Describe the bug
Deserializing a Bundle document in 5.3.0-R4 does not work for me.
It worked in 4.3.0-R4.
To Reproduce
Using 5.3.0-R4
Expected behavior
Deserialization using 5.3.0 works successfully, as it does in 4.3.0.
Screenshots
If applicable, add screenshots to help explain your problem.
Version used:
The text was updated successfully, but these errors were encountered: