This was a clear explanation. Thanks! On Mon, Jan 23, 2023 at 10:40 AM Lari Hotari <lhot...@apache.org> wrote:
> A potential breaking change would be the case when Java 8 support module > hasn't been registered and Jackson seems to serialize and de-serialize the > objects successfully, but with a obscure JSON structure. > > Jackson 2.12 introduced a solution to prevent this from happening for Java > 8 date/time types. (Jackson change: > https://github.com/FasterXML/jackson-databind/issues/2683) > Jackson 2.12 was first used in Pulsar 2.8.0 (Jackson upgrade 2.11 -> 2.12 > in https://github.com/apache/pulsar/pull/10782). > > If you try to use Java 8 date/time types with Jackson, you will get this > exception unless the Java 8 support modules are registered: > com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Java 8 > date/time type `java.time.Instant` not supported by default: add Module > "com.fasterxml.jackson.datatype:jackson-datatype-jsr310" to enable handling > > An example where Jackson doesn't fail at serialization time, is the usage > of java.util.Optional . However, the value doesn't get serialized at all > and deserialization fails. > > The risk of this being a breaking change is low since there doesn't seem > to be cases where serialization and de-serialization would work without the > Java 8 support modules using a bad JSON structure. > > > > Context question since I'm not familiar with functions: How does a > function > > author use Jackson provided by Pulsar? Why does pulsar provide Jackson to > > function? > > The Pulsar Functions will use JSON serialization/deserialization by > default. (documented in > https://pulsar.apache.org/docs/2.10.x/functions-develop/#serde ). The > runtime uses Jackson for this purpose. > > -Lari > > On 2023/01/17 07:01:13 Asaf Mesika wrote: > > Can the scenarios of breaking changes for users be described in the PIP > if > > they exist? If this is a breaking change, it might be a good thing to > point > > it out in the PIP and in the release notes ("If you did this, then > perhaps > > you want to do that"). > > > > Context question since I'm not familiar with functions: How does a > function > > author use Jackson provided by Pulsar? Why does pulsar provide Jackson to > > function? > > > > > > On Mon, Jan 16, 2023 at 12:12 PM Lari Hotari <lhot...@apache.org> wrote: > > > > > I created PIP-243, https://github.com/apache/pulsar/issues/19243 . > Since > > > this is already discussed in this thread, I'll open it directly for > voting. > > > > > > -Lari > > > > > > On 2023/01/09 11:05:35 Lari Hotari wrote: > > > > Hi all, > > > > > > > > Jackson has a separate Java 8 support modules for adding support for > > > proper serialization and deserialization of new classes that were > added in > > > Java 8 (Java 8 was released in 2014). > > > > > > > > These Jackson Java 8 support modules haven't been used in the Pulsar > > > code base. This is a pity. This causes a lot of pain when using Java > Time > > > classes in Pulsar applications or Pulsar Functions. There are ways to > get > > > the classes working for applications, but the documentation is > missing. It > > > would make things easier if the Java 8 support modules for Jackson > would be > > > included and registered by default. > > > > > > > > I have created a PR to register Jackson Java 8 support modules by > > > default for all Pulsar components. The PR is > > > https://github.com/apache/pulsar/pull/19161 . > > > > > > > > Please review and provide feedback. Do we need a PIP for this change? > > > > > > > > -Lari > > > > > > > > > >