-
-
Notifications
You must be signed in to change notification settings - Fork 136
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
[avro] Unable to encode and decodea POJO with an auto-generated schema #309
Comments
Looks like it should work, but to know for sure you would need to include definition of type |
The message definition is here: https://github.com/slackapi/java-slack-sdk/blob/main/slack-api-model/src/main/java/com/slack/api/model/Message.java I bet the issue is with the gson annotation that are being used |
Doing the same thing with plain json: public static <T> void json(Class<T> type, T instance) throws Exception {
var mapper = new ObjectMapper();
var raw = mapper.writer().writeValueAsBytes(instance);
var obj = mapper.readerFor(type).readValue(raw);
System.out.println("> " + raw);
System.out.println("> " + obj);
} Leads to:
|
Exception claims that
Gson annotations would not be used but you would likely need their equivalent for Jackson if default names are changed (which seems to be the case). |
I wrote a small example that is about encoding and decoding a POJO with an auto generated schema, the code is like:
When running the code, then an exception is thrown:
I'm not sure if this comes from how the
Message
class is implemented (unfortunately it is outside of my control) or about eh way I'm using jackson.Any help would be appreciated.
The text was updated successfully, but these errors were encountered: