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
When parsing finishes with issues, a DeserializationFailedException is thrown. This will signal to most people that deserialization has failed. However, this is not actually the intent: some of the issues found may be acceptable to the caller. Also, it is unclear that parsing continues until all issues are found, and that a poco is returned in the PartialResult property of the exception. Even when users would realize this, you'd still have to filter the issues for acceptable issues or real errors.
To make this easier to do, I propose to extend the current configuration interface of the System.Text.Json parsers like so:
var serializerOptions = new JsonSerializerOptions()
.ForFhir()
.Ignoring("JSON004", "JSON005");
In addition we can re-use the "standard set" of ignorable errors from FhirSerializationEngineFactory:
var serializerOptions = new JsonSerializerOptions()
.ForFhir()
.WithLeniency(BackwardsCompatible/Ostrich/etc);
Beneath this small layer of System.Text.Json, we could also adapt the new JsonPocoDeserializer() class with comparable methods:
var resource = Deserialize(jsonText, out var issues);
var deserializer = new JsonPocoDeserializer().WithLeniency(....).
var deserializer = new JsonPocoDeserializer().Ignoring(....).
I like the WithLeniency, although we have a slightly different syntax for configuring the FhirClient. Maybe we should add WithLeniency there, and adopt the other concrete methods (WithBackwardsCompatibleSerializer). In any case, keep this aligned.
The text was updated successfully, but these errors were encountered:
When parsing finishes with issues, a
DeserializationFailedException
is thrown. This will signal to most people that deserialization has failed. However, this is not actually the intent: some of the issues found may be acceptable to the caller. Also, it is unclear that parsing continues until all issues are found, and that a poco is returned in thePartialResult
property of the exception. Even when users would realize this, you'd still have to filter the issues for acceptable issues or real errors.To make this easier to do, I propose to extend the current configuration interface of the System.Text.Json parsers like so:
In addition we can re-use the "standard set" of ignorable errors from
FhirSerializationEngineFactory
:Beneath this small layer of System.Text.Json, we could also adapt the new JsonPocoDeserializer() class with comparable methods:
var resource = Deserialize(jsonText, out var issues);
var deserializer = new JsonPocoDeserializer().WithLeniency(....)
.var deserializer = new JsonPocoDeserializer().Ignoring(....)
.I like the
WithLeniency
, although we have a slightly different syntax for configuring theFhirClient
. Maybe we should addWithLeniency
there, and adopt the other concrete methods (WithBackwardsCompatibleSerializer
). In any case, keep this aligned.The text was updated successfully, but these errors were encountered: