-
Notifications
You must be signed in to change notification settings - Fork 160
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
Please Support JavaTimeModule #109
Comments
This one is invalid, since now the encoding/decoding is done manually in `cloudevents-json-jackson' module |
Can you please explain in more detail how this is invalid? I don't understand. |
Is there a cloudevents-json-jackson module this bug needs to be moved to? |
The json jackson module still has the same issues. It should not use a custom ZonedDateTime Ser/DeSer and should properly handle the new JavaTimeModule stuff. This bug should not be closed. |
Can I ask the reason why the custom serde is not valid? The serialization/deserialization is handled correctly serializing/deserializing using RFC3339 (as underlined by the spec https://github.com/cloudevents/spec/blob/v1.0/spec.md#type-system). I've tried the |
@slinkydeveloper I'm not sure I understand what you mean "serialize/deserialize" manually? You are using Jackson so I need to be able to extend and put my own types and types from other libraries so they will serialize correctly like.
Without JavaTimeModule I can't serialize the java 8 types related to time. Without the ability to add other modules like guava I can't serialize types from guava. I really need to be able to extend the Jackson configuration myself or else most POJOs will not be serializable. |
If you're referring to the event payload, in the v2 of the sdk, the |
So are you saying for unstructured i.e. application/json content type cloud events, the SDK v2 does not decode the body at all? |
The sdk v2 decodes the event, but not the "data" field of the event: https://github.com/cloudevents/sdk-java/blob/master/api/src/main/java/io/cloudevents/CloudEvent.java#L45 |
you can take the byte array fro |
There is no data field in in unstructured/binary application/json cloud events the ”data” is the entire HTTP request body. Cloud event stuff is just in the headers in that case not the body. You are talking about structured application/cloudevents events. https://github.com/cloudevents/spec/blob/master/http-protocol-binding.md#13-content-modes https://github.com/cloudevents/spec/blob/master/spec.md#message |
Ok maybe we misunderstood, but when you send the event in structured mode, encoded as json, there is a data field: https://github.com/cloudevents/spec/blob/v1.0/json-format.md#32-examples
In binary mode, the body of the http envelope maps to the cloudevent data attribute, as explained https://github.com/cloudevents/spec/blob/v1.0/http-protocol-binding.md#312-event-data-encoding |
With latest changes, in both cases (binary/structured), the data field is handled transparently and served as binary array, that you can handle as you want |
You can see in this code it is not, this is from the example. Your JSON decoder is used to decode the binary message into a Map.class https://github.com/cloudevents/sdk-java/tree/master/api
|
I'm sorry but these examples are still not updated, look at the tests 😄 |
I reorganized a bit the READMEs, check it out! |
Can we close this now? |
I'm going to close it, reopen if you need it |
It would be great if this SDK used a Jackson object mapper configured like the following, in this way I don't believe you would need any special ZonedDateTime code, this should handle it and allow for greater flexibility.
here are the references from my gradle.build.kts if that helps
Here is a test I wrote:
The text was updated successfully, but these errors were encountered: