Skip to content

SHOULD update schema to latest CE-spec schema? #383

Closed

Description

@c-pius

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:

const event = new CloudEvent({
      id: '0815',
      specversion: '1.0',
      type: 'my.event.type',
      source: '',
    })

    const validated = event.validate() // does not throw
    console.log(validated)  // true

Expected Behavior
Schema should be up to date so that event.validate() throws accordingly.

Additional context

Activity

  1. github-actions commented on Mar 14, 2021

    @github-actions
    Contributor

    This issue is stale because it has been open 30 days with no activity.

  2. grant commented on Sep 28, 2021

    @grant
    Member

    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.compile doesn't validate the length here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions