Skip to content

Ghost Serialization v1.2.7

Choose a tag to compare

@juanchurtado1991 juanchurtado1991 released this 09 Jul 04:27
· 334 commits to main since this release

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 ProtoAny dynamically via ProtoAnyRegistry using Ghost’s serializer registry.
  • Quotations & Unsigned Numeric Ranges: Unsigned 64-bit integer (uint64) backing via ULong with 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:

  1. Ghost Core JSON
  2. Ghost Proto3 JSON
  3. KotlinX Serialization (Standard JSON & Proto3 JSON)

🔗 Framework Integrations

  • Spring Boot Starter: GhostHttpMessageConverter now auto-detects classes annotated with @GhostProtoSerialization and routes them dynamically through the GhostProtoJsonFlatReader.
  • Ktor Content Negotiation: Added GhostProtoContentConverter alongside bypass helpers (bodyGhostProto(), respondGhostProto()).
  • Retrofit Client: Added GhostProtoConverterFactory for directly reading Proto3 JSON payloads.

🛠️ Bug Fixes & Conformances

  • Validation against Reference Implementation: Introduced ProtoJsonConformanceTest cross-checking output against Google's protobuf-java JsonFormat.Printer to 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_VALUE into "-0".
  • Fractional Seconds Widths: Duration and Timestamp now correctly pad fractional seconds to exactly 3, 6, or 9 digits as required by the Proto3 JSON specification.
  • Base64 Out-of-Bounds: Fixed potential ArrayIndexOutOfBoundsException when parsing invalid Base64 streams with non-Latin-1 characters.

💡 API & Internals Changes

  • Subclassing Support: Opened GhostJsonFlatReader for extension so that custom/protocol-specific readers (like GhostProtoJsonFlatReader) 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.