powertools-lambda-java icon indicating copy to clipboard operation
powertools-lambda-java copied to clipboard

Maintenance: V2 updates - review interface & propose improvements for Serialization module

Open scottgerring opened this issue 9 months ago • 3 comments

Summary

We should use the V2 release as an opportunity to reflect upon the interfaces of our existing modules and identify areas of improvement. This work has been done as part of rewrites for some modules, and in isolation for others - check out #1283 for details.

We should also integrate the v4 of aws-lambda-java-events.

Why is this needed?

  • Minimize the likelihood that we need to make more breaking changes to PT-Java again soon in the future
  • Double-down on the quality of the project by forcing large-scale code review
  • Increase knowledge of the modules around the contributor team

Which area does this relate to?

Serialization

Solution

  1. A review of the current module, its public interface and structure, and potential areas for improvement documented on this ticket for discussion
  2. A draft PR against the v2 branch showing the high level impact of proposed changes
  3. PR completed and merged into v2

Acknowledgment

scottgerring avatar Oct 10 '23 12:10 scottgerring

~~somehow linked to #1479~~

jeromevdl avatar Nov 22 '23 13:11 jeromevdl

Investigation Notes

Re-assessing the list of events supported in events v3 I see no events with user-defined payloads we are not already handling.

Modules that use ObjectMapper directly in v2:

  • powertools-validation (validates a JSON object against a JSON schema)
  • powertools-tracing (adding extra info to traces)
  • powertools-serialization
  • powertools-logging - the common library - serializing and deserializing events via captureCorrelationId, 2/ PowertoolsResolver uses ObjectMapper to check if something is JSON, and if it can be encoded without nested quotation into the logs
  • powertools-idempotency
  • powertools-parameters - Uses ObjectMapper in its JsonTransformer<T> class
  • powertools-cloudformation - Uses ObjectMapper to interact with Cloudformation's custom resources API

Internal dependencies on the powertools-serialization module:

Screenshot 2024-01-04 at 13 22 32

scottgerring avatar Jan 04 '24 08:01 scottgerring

Open questions:

  • Should powertools-parameters / JsonTransformer use the serialization ObjectMapper ? (probably yes?)
  • Should powertools-cloudformation use the serialization ObjectMapper? (probably not - CF serialization needs different from generic event model)
  • Should powertools-logging use the serialization ObjectMapper? (probably not - again, different serialization configuration needs)
  • jackson-jr ?

scottgerring avatar Jan 04 '24 12:01 scottgerring