coinbase/mesh-sdk-go

Replace metadata request map type with json.RawMessage type

yorhodes opened this issue · 1 comments

Is your feature request related to a problem? Please describe.
It is cumbersome to use the map type for marshalling and unmarshalling within the Celo client and server implementations because validation must be done on an enumerated list of key strings.

https://github.com/coinbase/rosetta-sdk-go/blob/2989e4b865ead7997719ce23c7d1ce3a941d6c74/types/metadata_request.go#L22

Describe the solution you'd like
I would like to be able to codegen marshallers as defined by the shape of our structs and validate metadata using these marshallers.

Describe alternatives you've considered
None.

Additional context
See https://github.com/celo-org/rosetta/blob/c51cfc731a13672a34f78cafff42978bea3574c9/service/rpc/servicer.go#L397

Very much agree that this will make the Metadata field much more powerful. In doing some exploration for this change, found out you need to do some pretty crazy stuff to get reflect.DeepEqual to work on structs that contain json.RawMessage: https://play.golang.org/p/uME071lw_fi