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

Be able to skip serialisation #859

Open
morganleroi opened this issue Sep 2, 2024 · 3 comments
Open

Be able to skip serialisation #859

morganleroi opened this issue Sep 2, 2024 · 3 comments
Assignees

Comments

@morganleroi
Copy link
Contributor

What is about my JRaw? It is relatively easy to implement with a custom converter and it would be great to accept serialized objects: https://learn.microsoft.com/en-us/dotnet/api/system.text.json.utf8jsonwriter.writerawvalue?view=net-6.0

An alternative could be to pass a JsonSerializerOptions.

Originally posted by @SebastianStehle in #852 (comment)

@morganleroi
Copy link
Contributor Author

@SebastianStehle could you share a chunk of code you use with the v6 client ?

@SebastianStehle
Copy link

Sure, but I am not sure if it helps: https://github.com/Squidex/squidex/blob/master/backend/extensions/Squidex.Extensions/Actions/Algolia/AlgoliaActionHandler.cs#L123

There are two reasons I want to have that:

  1. I use that for a job system and I write the serialized payload to the job table. If something goes wrong (which does not happen very often) I do not have to serialize it again.
  2. I want to be independent from the serialization in algolia. For example I have migrated to System.Text.Json a few years ago, which Algolia was still using Newtonsoft. I also have dozens of custom converters that I need to serialize it properly.

As an alternative I would probably deserialize it into a JsonDocument (from System.Text.Json) and then the client would serialize it again).

@morganleroi morganleroi self-assigned this Sep 2, 2024
@furoTmark
Copy link

In my current project, we would also benefit from being able to add the objects directly serialized by us (because we also use custom converters) to Algolia.
This way we could also take advantage even more of the schemaless way Algolia is storing the data.

Happy to draw up a PR.

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

No branches or pull requests

3 participants