Open elcolto opened 5 months ago
Not as easy as expected. I did not find a way to provide the Serializer for multiple sub-types, so we can't get rid of the warning. I would not recommend to remove the serializeWith or the custon serializers. KotlinxSerialization only serializes the type if the type is generic during compile time. So if you try to serialize
val point: Point = Point(...)
println(Json.encodeToString(point))
the type gets scraped, whereas
val point: Geometry = Point(...)
println(Json.encodeToString(point))
would print the type, as the type expected to be generic here.
Additionally, the custom serializers contain some logic, such as the BoundingBoxSerializer that ensures that the array contains 4/6 entries to ensure a valid 2d/3d coordinate representative
Maybe we should convert all Serializer to internal
visibility
Maybe a polymporph serializer would fit better