sdk-go
sdk-go copied to clipboard
argo events cannot be Unmarshaled
Here's argo events' data
{
"context": {
"type": "type_of_event_source",
"specversion": "cloud_events_version",
"source": "name_of_the_event_source",
"id": "unique_event_id",
"time": "event_time",
"datacontenttype": "type_of_data",
"subject": "name_of_the_configuration_within_event_source"
},
"data": {
"header": {},
"body": {},
}
}
But when I run
ev := cloudevents.NewEvent()
err := json.Unmarshal(data, &ev)
it reports error. It seems that attributes shouldn't be wrapped into context
key?
And here's argo events' doc: https://argoproj.github.io/argo-events/tutorials/02-parameterization/#webhook-event-payload