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
{{ message }}
Repository navigation
SHOULD update schema to latest CE-spec schema? #383
Describe the Bug
The schemaV1 is currently not up to date with the one from the specification (e.g. spec schema contains source minLength 1, SDK schema doesn't). Therefore, event.validate() does for instance not throw when source is an empty string.
Steps to Reproduce
Use the following snippet:
constevent=newCloudEvent({id: '0815',specversion: '1.0',type: 'my.event.type',source: '',})constvalidated=event.validate()// does not throwconsole.log(validated)// true
Expected Behavior
Schema should be up to date so that event.validate() throws accordingly.
Activity
github-actions commentedon Mar 14, 2021
This issue is stale because it has been open 30 days with no activity.
grant commentedon Sep 28, 2021
Yeah, it looks like we should add the check that properties that should be non-empty are in-fact non-empty.
Code change would be here:
https://github.com/cloudevents/sdk-javascript/blob/main/src/event/spec.ts
Not sure why
ajv.compiledoesn't validate the length here.fix: ensure source property has min length of 1
fix: ensure source property has min length of 1 (#438)