-
Notifications
You must be signed in to change notification settings - Fork 0
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
better API design for schema based formats #4
Comments
After thinking this through there are two separate aspects:
Actually 1. is rather complex. If you do not want to go for a one-fits-all approach and (e.g. only supported via generated code or define a strict way to map schemas from For 2. I think it is very simple: If you want to fully go for gRPC you would use googles approach and not our marshaling. Google goes for code generation and this way ensures the code is efficient and consistent in computing the correct size before the actual object is written. Also this is an asymmetric problem that only occurs when marshaling data but not during unmarshaling. |
All done and implemented now (For the record: the previous comment was posted by me 1+ weeks ago but seemed to got stuck in my browser so it only went out today after completing this story). |
With
mmm-marshall
we support a variety of structured data formats. While JSON and YAML are fine and do not require external information, it is more tricky for formats such asgrpc/protobuf
oravro
. Those rely on a given schema e.g. to map property names to numeric values and vice versa.To support
grpc
we started changing our APIs in various places but this approach seems odd and flawed. Especially ugly is thatgrpc
requires the size of an object before it is written.This way with every new such format that we want to support, we might need to do unforeseeable breaking API changes.
Instead we should redesign our API now such that this can be prevented in the future and we can even remove the already introduced changes for
grpc
inmmm-property
andmmm-bean
that seem kind of misplaced.The general idea is that we need to receive additional information about the object (e.g. bean) that is currently read or written.
Implementations for e.g.
grpc
can use this information to find the according ID mapping (e.g. accessing cached and lazily loaded*.proto
files).The text was updated successfully, but these errors were encountered: