Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP.toEvent is lacking the cloudevents specification and accepts invalid objects #597

Open
mhay-at-dvelop opened this issue Nov 7, 2024 · 0 comments

Comments

@mhay-at-dvelop
Copy link

mhay-at-dvelop commented 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

  1. Use example "Receiving events" from sdk-javascript documention
  2. 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"
    }
    }
  3. 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 .

@mhay-at-dvelop 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant