-
Notifications
You must be signed in to change notification settings - Fork 70
Closed
Labels
module/libRelated to the main source codeRelated to the main source codespec/0.3Support for spec v0.3Support for spec v0.3spec/1.0Issues related to the CE specificationIssues related to the CE specificationtype/bugSomething isn't workingSomething isn't working
Description
Describe the Bug
When creating or receiving a CloudEvent
, if the data is in the form of an Array - which is valid JSON - we get a validation error.
Steps to Reproduce
- use
new CloudEvent()
to create an event with thedata
property as an array. For example:
const ce = new CloudEvent({ source: '/test', type: 'example', data: [ 1, 2, 3 ] });
That will produce:
TypeError: invalid payload
at Object.validateV1 (src/event/spec.ts:14:11)
at CloudEvent.validate (src/event/cloudevent.ts:178:16)
at new CloudEvent (src/event/cloudevent.ts:121:10)
Expected Behavior
No error thrown.
Additional context
The schema seems to have wrongly typed data here https://github.com/cloudevents/sdk-javascript/blob/master/src/event/schemas.ts#L12-L14 and here https://github.com/cloudevents/sdk-javascript/blob/master/src/event/schemas.ts#L91-L93
Metadata
Metadata
Assignees
Labels
module/libRelated to the main source codeRelated to the main source codespec/0.3Support for spec v0.3Support for spec v0.3spec/1.0Issues related to the CE specificationIssues related to the CE specificationtype/bugSomething isn't workingSomething isn't working