Ghost Serialization v1.2.7
Production-ready, zero-allocation serialization engine for Kotlin Multiplatform. This release introduces support for Proto3 JSON mapping, brings robust HTTP integrations for Ktor, Retrofit, and Spring Boot, adds coverage-guided fuzz testing, and fixes critical edge-case serialization bugs.
📦 New Module: ghost-protobuf
We have introduced a new Kotlin Multiplatform module (com.ghostserializer:ghost-protobuf) which layers Proto3 JSON mapping rules on top of the zero-allocation JSON engine.
- Multiplatform Targets: Android, iOS (Arm64 & Simulator), and JVM.
- Well-Known Types (WKTs): Zero-allocation serializers for
ProtoDuration,ProtoTimestamp(nanosecond precision, RFC3339 compliant),ProtoStruct,ProtoValue,ProtoAny, and scalar wrapper types (ProtoBoolValue,ProtoInt32Value, etc.). - Any Type Registry: Resolve
ProtoAnydynamically viaProtoAnyRegistryusing Ghost’s serializer registry. - Quotations & Unsigned Numeric Ranges: Unsigned 64-bit integer (
uint64) backing viaULongwith correct string quoting and boundaries support.
⚡ ProtoLab Benchmark (Sample App)
Added a new interactive UI page to the sample app to compare performance under real-world scenarios (using OpenLibrary API payloads) between:
- Ghost Core JSON
- Ghost Proto3 JSON
- KotlinX Serialization (Standard JSON & Proto3 JSON)
🔗 Framework Integrations
- Spring Boot Starter:
GhostHttpMessageConverternow auto-detects classes annotated with@GhostProtoSerializationand routes them dynamically through theGhostProtoJsonFlatReader. - Ktor Content Negotiation: Added
GhostProtoContentConverteralongside bypass helpers (bodyGhostProto(),respondGhostProto()). - Retrofit Client: Added
GhostProtoConverterFactoryfor directly reading Proto3 JSON payloads.
🛠️ Bug Fixes & Conformances
- Validation against Reference Implementation: Introduced
ProtoJsonConformanceTestcross-checking output against Google'sprotobuf-javaJsonFormat.Printerto ensure 100% compliance. - Fixed Sign Loss on Durations: Fixed an issue where negative durations under one second (e.g.,
-0.5s) lost their sign. - Long.MIN_VALUE Edge Case: Corrected negative space overflow in boundary numeric conversions that previously corrupted
Long.MIN_VALUEinto"-0". - Fractional Seconds Widths:
DurationandTimestampnow correctly pad fractional seconds to exactly 3, 6, or 9 digits as required by the Proto3 JSON specification. - Base64 Out-of-Bounds: Fixed potential
ArrayIndexOutOfBoundsExceptionwhen parsing invalid Base64 streams with non-Latin-1 characters.
💡 API & Internals Changes
- Subclassing Support: Opened
GhostJsonFlatReaderfor extension so that custom/protocol-specific readers (likeGhostProtoJsonFlatReader) can override parsing behavior without duplicating the buffer implementation. - CI Stability: Resolved a CI Gradle runner GPG signing exception during JVM unit test suites on host-clean runners.