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

Move SystemTextJsonSerializer base class to Elastic.Transport #117

Closed
flobernd opened this issue Oct 8, 2024 · 0 comments · Fixed by #119
Closed

Move SystemTextJsonSerializer base class to Elastic.Transport #117

flobernd opened this issue Oct 8, 2024 · 0 comments · Fixed by #119

Comments

@flobernd
Copy link
Member

flobernd commented Oct 8, 2024

Proposal

Move SystemTextJsonSerializer from Elastic.Clients.Elasticsearch to Elastic.Transport as a public base serializer.

Apply the required modifications to strip IElasticsearchClientSettings.

In Elastic.Transport, make LowLevelRequestResponseSerializer derive from SystemTextJsonSerializer.

In Elastic.Clients.Elasticsearch, make DefaultSourceSerializer derive from SystemTextJsonSerializer.

Intention

This is a predecessor step of moving the static SourceSerialization helper class from Elastic.Clients.Elasticsearch to Elastic.Transport and renaming it to SerializerHelper.

This class should serve as a user-facing interface for (de-)serialization as an alternative to directly calling the methods defined in Serializer.

The class should primarily provide System.Text.Json based overloads (like using Utf8JsonReader, JsonNode, etc. instead of Stream) and internally shortcut these overloads to directly use JsonSerializer, if the given Serializer implementation derives from SystemTextJsonSerializer.

Why?

This makes it easier for our users to further convert object/JsonElement values into specialized types without having to use complicated workarounds.

It as well allows use to use the shortcut serialization path in high level integrations in a standard way.

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