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
Event.validate() is not functioning correct (tested in the express-ex example)
Steps to Reproduce
let e = HTTP.toEvent({headers: req.headers,body: { "a space": "not allowed", specversion: "1.0", source: "source1", id: "1", type: "test" }
e.validate() //no error
Expected Behavior
An error (just like when an ext.attribute with the name "Acapital" is used).
Additional context
The problem seems to lie in spec.ts because of a broken reference tot the v1-schema. Looks as if it's there since release 5.4.0 when a separate schema-folder was created.
The problem seems to lie in spec.ts because of a broken reference tot the v1-schema. Looks as if it's there since release 5.4.0 when a separate schema-folder was created.
I know it seems that way, but the schema is actually precompiled at build time, so you don't see it in this source repository. You can see where this was changed here: #471 and where it actually happens during the build here:
This seems like a genuine bug in the validation code. Extensions, unfortunately, do not have a formalized JSON spec that we can use to generate a validator (pretty sure about that). You can see in the CloudEvent spec that it does not mention extensions: https://github.com/cloudevents/spec/blob/main/cloudevents/formats/cloudevents.json. Thanks for reporting this.
Activity
lance commentedon Jun 21, 2022
I know it seems that way, but the schema is actually precompiled at build time, so you don't see it in this source repository. You can see where this was changed here: #471 and where it actually happens during the build here:
sdk-javascript/package.json
Line 10 in 847f6bf
This seems like a genuine bug in the validation code. Extensions, unfortunately, do not have a formalized JSON spec that we can use to generate a validator (pretty sure about that). You can see in the CloudEvent spec that it does not mention extensions: https://github.com/cloudevents/spec/blob/main/cloudevents/formats/cloudevents.json. Thanks for reporting this.
fix: improve validation on extension attribute
fix: improve validation on extension attribute (#502)