I am creating a proto file (and following cloudEvents standards).
syntax = "proto3";
option go_package = "/events";
import "google/protobuf/timestamp.proto";
import "google/protobuf/any.proto";
message Event {
string specversion = 2;
string type = 3;
string source = 4;
string id = 5;
google.protobuf.Timestamp time = 6;
google.protobuf.Any data = 7;
map<string, CloudEventAttributeValue> attributes = 8;
string datacontenttype = 9;
string test = 10;
}
It works well between client and server. We also want to make sure that this object is totally conformant to cloudevents. To test this out If I tried marshalling this object using json.marshal() and then unmarshal using json.unmarshal into a cloudEvent object. In this test deseriallization is breaking due to time field datatype mismatch between proto object and cloudEvents.
bytes, _ := json.Marshal(ev)
fmt.Println(string(bytes))
e := cloudevents.NewEvent()
json.Unmarshal(bytes, &e)
But if I remove the time field, everything works well. Any idea what am I missing?