Skip to content

Conversation

@lilgallon
Copy link
Member

@lilgallon lilgallon commented Oct 8, 2025

The generic OcpiSerializer interface maintains compile-time type information throughout the serialization/deserialization process. This design allows the library to utilize kotlinx.serialization's reflection-free approach, ensuring better performance and type safety.

The serializer generator was developed to address a key architectural constraint: the domain classes reside in a separate module that must remain independent of any specific marshalling approach (serialization/deserialization). Adding @Serializable annotations directly to these domain classes would create an unwanted dependency on kotlinx.serialization, violating the module's framework-agnostic design. The generator uses the surrogate pattern to create serialization logic externally, keeping the domain layer clean and allowing different serialization strategies to coexist without modifying the core domain model.

The mapping is the same as Jackson, but with better performances. Jackson's mixins behavior is covered with tests, and kotlinx.serialization implementation respects them

I may create a specific lib for this generator as it can be useful in any kotlinx.serialization project, but for now it stays here :)

@lilgallon lilgallon linked an issue Oct 8, 2025 that may be closed by this pull request
@lilgallon lilgallon force-pushed the feat/#168-pluggable-serialization-support branch from 3210380 to 574f410 Compare October 22, 2025 17:51
@lilgallon lilgallon changed the base branch from feat/#168-pluggable-serialization-support to main October 22, 2025 17:52
The lib had to be changed because 10.00 is different from 10.0 and 10. We needed a lib with more settings
... this could really be a lib, and I think I will extract this code in a lib
@lilgallon lilgallon force-pushed the feat/#170-kotlinx-serialization-support branch from 3c5f5c6 to 95f36f9 Compare October 22, 2025 17:52
@lilgallon lilgallon merged commit 7d5aa30 into main Oct 22, 2025
1 check failed
@sonarqubecloud
Copy link

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.

Add kotlinx serialization support

3 participants