-
Notifications
You must be signed in to change notification settings - Fork 80
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
Python: Add Optional ObjectMapper
Argument to Kafka Consumer json_spec
#4178
Comments
Jianfeng nate Also, the JPY for just the object mapper is pretty easy. Jianfeng nate Jianfeng nate This is the source: https://github.com/FasterXML/jackson-core/blob/2.16/src/main/java/com/fasterxml/jackson/core/json/JsonReadFeature.java Jianfeng nate
|
@rcaudy @chipkent I have captured the conversation @nbauernfeind and I had over how we should approach the change. It doesn't seem be a good way to make it Pythonic or user friendly. What are your thoughts? |
I am not familiar with all of the Kafka code, so take my comments with a grain of salt. We wouldn't need to support all of the enum values because there are Using the strings, there could be a configuration like: This gets to the part that is less obvious to me. I'm not sure how the jackson XML parse plays into the bigger picture. Will it always be with us? Is it an option? Does it have to work with Given my uncertainty, would something like this work:
|
So, one could make a good case that we're leaking internal API details by exposing the ObjectMapper to the API. On the other hand, at this time the Jackson JSON parser is by far the most adopted; if we were to move away from that, we would need to deprecate API methods that exposed ObjectMapper. Configure is interesting; it would certainly let us stringify the interface, although without giving us any long-term API safety, since we're still exposing Jackson API details. The alternative approach is to wrap all the options we want to permit; this is vastly more onerous for the implementor (us) with limited payoff. The other major downside here is that we have to do work for any feature the user may want that we didn't code for. We could declare that the existing JSON spec is forever going to use Jackson until/unless we deprecate and remove it, and that we will add new names/factories if we switch to a different backend. Or we could build some kind of JSON parsing interface, with an extensible Jackson-based implementation, and give users more control if they want it. |
I think it makes sense to add some common optional params to |
|
In #4164 I've added the ability to pass in a custom ObjectMapper for Kafka consumption to use when deserializing from json. We need some form of plumbing in Python. I'm suspecting a change to
json_spec
that allows us to pass in the Java object. We can probably stick to JPY to construct the object mapper.This is the code snippet I've given a community user:
The text was updated successfully, but these errors were encountered: