You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the Bug
I'm trying to implement a rest-api for nodejs application with this sdk-javascript. when using HTTP.toEvent Method it returns an Object even when its semantically invalid compared to the cloudevents specification. So for example if you not supply the "type" property the method returns a cloud-event object with a type property which is undefined. Also if not supplying the specversion property it sets this property in result with a default value "1.0". Specification says that this property must be supplied, not that it is optional with a default value.
In my mind the method must not return a cloudevent object if it conflicts with the cloudevent specification.
Steps to Reproduce
Use example "Receiving events" from sdk-javascript documention
Use Postman to send a cloudevent with following structure (without specversion and type):
{
"source":"Source as a URI spec#123",
"id":"b25e2717-a470-45a0-8231-985a99aa9416",
"time":"2019-11-06T11:08:00Z",
"datacontenttype":"application/json",
"data":{
"much":"wow"
}
}
Check returning result from HTTP.toEvent. Resulting object has now a default "specversion" property with value 1.0 and an "type" property with value "undefined".
Expected Behavior
Should return error or throw exception in the mentioned cases .
The text was updated successfully, but these errors were encountered:
mhay-at-dvelop
changed the title
HTTP.toEvent is lacking the cloudevents definition and accepts invalid objects
HTTP.toEvent is lacking the cloudevents specification and accepts invalid objects
Nov 7, 2024
Describe the Bug
I'm trying to implement a rest-api for nodejs application with this sdk-javascript. when using HTTP.toEvent Method it returns an Object even when its semantically invalid compared to the cloudevents specification. So for example if you not supply the "type" property the method returns a cloud-event object with a type property which is undefined. Also if not supplying the specversion property it sets this property in result with a default value "1.0". Specification says that this property must be supplied, not that it is optional with a default value.
In my mind the method must not return a cloudevent object if it conflicts with the cloudevent specification.
Steps to Reproduce
{
"source":"Source as a URI spec#123",
"id":"b25e2717-a470-45a0-8231-985a99aa9416",
"time":"2019-11-06T11:08:00Z",
"datacontenttype":"application/json",
"data":{
"much":"wow"
}
}
Expected Behavior
Should return error or throw exception in the mentioned cases .
The text was updated successfully, but these errors were encountered: