Open
Description
I was playing with an example on using the cloneWith
method of the CloudEvent class and i noticed that the new returned(cloned) CloudEvent has the same id
and time
values.
So for example:
const ce = new CloudEvent({....});
ce.toJSON();
// might be something like this:
{
id: 12345,
time: '1:00 pm' // i know that is not the format
}
And then if we wanted to add an extension, for instance, we could clone it into a new cloud event
const ce2 = ce.cloneWith({extenstion: 'Vaule'});
c2.toJSON()
// might be something like this:
{
id: 12345,
time: '1:00 pm',
extension: 'Value'
}
I wasn't sure if that is correct or not. I can go either way on this. On one hand, it is just a clone with added features, but on the other hand, we are creating a brand new CloudEvent, so should the id and time be recreated?