-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kotlinx.serialization integration for payload #112
Comments
+1 That's quite nice. Metadata serialization is important, I assume you mean independently from the data. |
If so, we will need to integrate it somehow with future composite metadata support, and also 3 point become harder to design right API.
|
"future composite metadata support" - that was my point. I'm finding that I'm needing to serialize with the rsocket-java code, and porting that looks like not much fun. Ideally we would have nice kotlin support for routing, tracing etc. But maybe these can't be converged? |
Composite metadata support is my next task in todo list (together with extension metadatas like routing, tracing, auth). Will look later if it's possible to combine them in nicer way, than in my previous message. |
+1. The API proposal looks good to me as well! |
This is the metadata section that's quite awkward for me (but discrete thankfully).
|
It would be good to provide out of the box integration with kotlinx.serialization for serializing models into payload
data
(is metadata serialization needed?). kotlinx.serialization supports both binary formats such as CBOR and ProtoBuf, and string JSON format (and other custom community driven formats).Possible implementations:
format.decodeFromPayload<ModelType>(payload)
where:ModelType
- resulting type (should be annotated withSerializable
annotation),format
- JSON/ProtoBuf/CBOR format (or any other custom format)format.encodeToPayload(model, [optional metadata])
wheremodel
- entity to serialize,format
- supported formatfun <T, R> requestResponse(data: R, metadata: ???): TypedPayload<R>
where: T - type of request data, R - type of respose data,TypedPayload
- payload, which containsdata
as typeR
and metadataThe text was updated successfully, but these errors were encountered: