Skip to content

SqlRowConverter does not implement JsonConverter #7715

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

Closed
felix-stnr opened this issue May 10, 2023 · 3 comments
Closed

SqlRowConverter does not implement JsonConverter #7715

felix-stnr opened this issue May 10, 2023 · 3 comments
Labels
8.x Relates to a 8.x client version

Comments

@felix-stnr
Copy link

felix-stnr commented May 10, 2023

Elastic.Clients.Elasticsearch version: 8.1.1

Elasticsearch version: 8.7.0

.NET runtime version: .NET 7.0.23

Operating system version: Windows 11

Description of the problem including expected versus actual behavior:
The SqlRowConverter, which is located within the SqlRow class (see here) overrides the method Write from the JsonConverter base class. However, this method is not implemented yet and hence always throws a NotImplementedException. Thus, serializing the response will always lead to an exception. To fix this bug the Write method should be correctly overwritten/implemented.

Maybe this issue is related to #7713.

@felix-stnr felix-stnr added the 8.x Relates to a 8.x client version label May 10, 2023
@felix-stnr felix-stnr changed the title SqlRowConverter does not implement serialization SqlRowConverter does not implement JsonConverter May 10, 2023
@stevejgordon
Copy link
Contributor

Hi, @felix-stnr. Why are you serializing the response? The response types are only expected to be deserialized from the JSON sent by the server. We don't guarantee that they will be serializable unless used on requests.

@felix-stnr
Copy link
Author

Hi there. The main reason why I wanted to serialize the response is that I want to forward it to another client, which relies on a specific JSON format. Since the SqlRow derives from the JsonConverter class, I expected the serialization to work out of the box. After always running into the same exception, I took a look at the code of the SqlRow and saw that this functionality was not implemented. But I guess implementing the serialization in the Elasticsearch .NET client directly would not align with the concept you just mentioned. Therefore, I am not sure anymore if this is actually an issue or just expected behavior.
Moreover, it turned out that handling the serialization in my own code is rather easy.

@stevejgordon
Copy link
Contributor

@felix-stnr Yes, this is by design in the client (for now, at least) since it's a read-only type from our perspective. We recommend that consumers convert data from our types to their own types before sending data downstream. I'm going to close this issue, and we can always revisit it if this use case comes up regularly.

@stevejgordon stevejgordon closed this as not planned Won't fix, can't repro, duplicate, stale May 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.x Relates to a 8.x client version
Projects
None yet
Development

No branches or pull requests

3 participants