chaokunyang commented on issue #1799: URL: https://github.com/apache/fory/issues/1799#issuecomment-4645508867
You can create a map subclass named as `ForyExtraFields`, which hold all missing fields ,and also a transient `TypeDef` objects. - For deserialization, put missing fields into this map instead of skipping it when generating code. - For serialization, we use local class generated serializer to serialize data currently, but it will only serialize local fields, whcih will ignore data in `ForyExtraFields`. So you need to update CompatibleCodecBuilder to generate serializer instead too, and serialize fields in `ForyExtraFields` per fory struct serialization protocol, so remote class could deserialize the data into its local fields. And keep current serializer dispatch logic in TypeResolver intact, but in original serializer serialize method, check whether `ForyExtraFields.getTypeDef().getId()` is equal to local id, if not, query TypeInfo and Serializer using the meta id, then forward the serialization into serializer generated by `CompatibleCodecBuilder` instead. If no `ForyExtraFields` field exist, do not introeduce such generated code. - KSP, Scala Derive, Java annotation processor, and StaticCompatibleCodecBuilder are statically generated serializer, which also need to support `ForyExtraFields`. - ObjectSerializer, CompatibleObjectSerializer, CompatibleLayerSerializer and CompatibleLayerCodecBuilder also need to support this `ForyExtraFields`. TBO, this is a pretty complex feature. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
