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

FhirSerializationEngine Compact serialization #2824

Closed
mharthoorn opened this issue Jul 24, 2024 · 2 comments
Closed

FhirSerializationEngine Compact serialization #2824

mharthoorn opened this issue Jul 24, 2024 · 2 comments
Assignees

Comments

@mharthoorn
Copy link
Member

The current implementations of IFhirSerlializationEngine that can be created from the FhirSerializationEngineFactory all serialize "pretty" output: using indentation and newlines.

There is also a use case for compact serialization, for performance, and memory and bandwidth optimization scenario's.

Additions from @ewoutkramer:

  • Could be done using FhirJsonPocoSerializerSettings. But not easily with something like Ostrich.Pretty()
  • we'd also need to add FhirXmlPocoSerializationSettings to the signature (since its mostly empty now, we are just generating the default internally)
@Kasdejong
Copy link
Contributor

Kasdejong commented Jul 30, 2024

We have this in the FhirJsonSerializerOptionExtensions in the shape of the .UsingMode(mode).Pretty() and UsingMode(mode).Compact() extensions :). Unfortunately this is limited to the Json serializers

@Kasdejong
Copy link
Contributor

The issue here is that pretty and compact notations are handled by System.Text.Json directly as opposed to our tooling. When we use the JsonSerializerOptions, we get an UTF-8 writer to write to, and STJ handles the formatting. When a BaseFhirJsonPocoSerializer is created (which is done internally in the engine factory), we do not have access to this. In that case, we have to do the formatting ourself, which we do not currently do. We may have to implement this at some point, but for now, at least for JSON, our higher level API with .ForFhir supports formatting while our serialization engines and base serializers do not.

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

No branches or pull requests

2 participants