Skip to content

Conversation

@deusaquilus
Copy link
Member

@deusaquilus deusaquilus commented Dec 4, 2025

This pull request refactors and improves how JSON values are encoded and decoded across different JDBC and R2DBC database controllers. It standardizes the JSON encoding logic, introduces new encoding objects for text-based JSON handling, and adds comprehensive tests for JSON serialization/deserialization with various databases.

Encoding and Decoding Improvements

  • Replaces the previous AdditionalPostgresEncoding and R2dbcPostgresAdditionalEncoding objects with new, standardized JsonObjectEncoding and R2dbcJsonObjectEncoding objects for handling JSON values in Postgres controllers. This makes the encoding logic more consistent and easier to maintain. [1] [2] [3] [4]
  • Adds new JsonTextEncoding and R2dbcJsonTextEncoding objects for handling JSON as text (VARCHAR/String) in non-Postgres databases (H2, MySQL, Oracle, Sqlite, SqlServer) for both JDBC and R2DBC controllers. Each controller now copies its encoding configuration to include these new encoders and decoders. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]

Codebase Consistency

  • Refactors controller classes to use open class instead of class, improving extensibility and consistency across the codebase. [1] [2] [3] [4] [5]

Testing Enhancements

  • Adds new test specs for JSON encoding/decoding for H2, MySQL, Oracle, and Sqlite databases. These tests verify that the SqlJsonValue annotation works correctly for both inner data classes and annotated fields, ensuring reliable serialization and deserialization of JSON values. [1] [2] [3] [4]

File and Naming Updates

  • Renames R2dbcPostgresAdditionalEncoding.kt to R2dbcJsonObjectEncoding.kt to better reflect its purpose and contents.

Overall, these changes make JSON handling across different database controllers more robust, consistent, and easier to test and extend.

@deusaquilus deusaquilus merged commit fa65c32 into main Dec 4, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants