Skip to content
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

Base POCO parsers/serializers on POCO, not IROD #2950

Open
wants to merge 7 commits into
base: develop-6.0
Choose a base branch
from

Conversation

ewoutkramer
Copy link
Member

@ewoutkramer ewoutkramer commented Oct 23, 2024

  • ⚠️ BREAKING: Based the parsers/serializers on Base instead of IReadOnlyDictionary<>. Should not really matter, since internally, the code required the things to be subclasses of Base anyway to function correctly.
  • Added extensions so subtrees van be serialized, if the underlying engine is our new POCO serializer
  • Added extensions so one can serialize to/from streams, if the underlying engine is our new POCO serializer.
  • ⚠️ BREAKING: Removed the obsolete FhirJsonConverter constructors (use the ForFhir extension methods on JsonSerializerOptions).
  • ⚠️ BREAKING: Renamed methods on the IFhirSerializationExtensions, since they made no sense (e.g. DeserializeReaderToJson has become DeserializeFromJsonReader).

Fixes #2917.

# Conflicts:
#	src/Hl7.Fhir.Base/CompatibilitySuppressions.xml
# Conflicts:
#	src/Hl7.Fhir.Base/CompatibilitySuppressions.xml
#	src/Hl7.Fhir.Base/Serialization/BaseFhirJsonPocoSerializer.cs
#	src/Hl7.Fhir.Base/Serialization/FhirJsonConverter.cs
@@ -84,8 +88,11 @@ public static async Task<string> ToXmlAsync(this ITypedElement source, FhirXmlSe
return await SerializationUtil.WriteXmlToStringAsync(async writer => await source.WriteToAsync(writer, settings).ConfigureAwait(false), settings?.Pretty ?? false,
settings?.AppendNewLine ?? false).ConfigureAwait(false);

var engine = FhirSerializationEngineFactory.Strict(ModelInspector.ForType(b.GetType()));
return ((PocoSerializationEngine)engine).SerializeToXml(b);
// Note that this code is temporary, as we the above code will be re-instated here. It's therefore
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if it is temporary, maybe we should mark it with [TemporarilyChanged]?

return SerializationUtil.WriteXmlToString(source, (s,w) => s.WriteTo(w, settings),
settings?.Pretty ?? false, settings?.AppendNewLine ?? false);

// Note that this code is temporary, as we the above code will be re-instated here. It's therefore
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if it is temporary, maybe we should mark it with [TemporarilyChanged]?

Copy link
Contributor

@Kasdejong Kasdejong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I accidentally set the review to "comment" instead of "request changes", this should tag it appropriately

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants