This repository was archived by the owner on Mar 28, 2023. It is now read-only.
This repository was archived by the owner on Mar 28, 2023. It is now read-only.
Separate responsibilities for model behavior and API presentation for protobufs #1600
Open
Description
We pass around pb.RicardianContract
s as defacto representations of transactions on the network via multiple interfaces, most notably the HTTP API and via protocol messages. This shared responsibility creates problems when attempting to reconcile new features against all responsibilities. In order to divide these responsibilities, the following patterns are being recommended:
- local structs (likely defined in
repo
) to keep our model behavior consistent throughout the app; where all data-specific logic should live - presentation via the HTTP API may also be handled by local structs, but as the presentation becomes complex, it should be separated from the model with each custom "presentation" handled by a different struct
- protobufs will be used for protocol messaging (over-the-wire representations via libp2p (binary) and ipfs (json))
There are a number of protobufs which need this treatment, starting with pb.RicardianContract
. This issue will track the objects to which we want to apply this pattern. This issue will track the exploration of how this might work.