Skip to content

Event source should not be required when emitting events #298

Description

@ricardozanini

Description

When emitting events using the emit task, the SDK requires the source property to be set. If not provided, validation fails with an error.

Per the specification (PR #1175, Issue #1174), the source property should be optional — it can be auto-generated by runtime implementations (e.g., from the workflow identity /{namespace}/{name}/{version}) at emission time. When explicitly provided by the workflow author, the supplied value takes precedence over the auto-generated one.

Root Cause

The specification schema (workflow.yaml) has required: [ source, type ] in the emitTask definition's with property. This has been fixed to required: [ type ] in specification PR #1175.

Once the spec change is merged and a new schema version is released, running npm run codegen will regenerate the TypeScript types and make source optional in EmitEventWith.

Expected Behavior

Users should be able to emit events without specifying source:

emit:
  event:
    with:
      type: com.example.my-event
      data: ${ .result }

The runtime should auto-generate source (e.g., from the workflow identity).

Actual Behavior

Validation fails because source is marked as required in the generated TypeScript types (EmitEventWith.source: EventSource instead of EmitEventWith.source?: EventSource).

Resolution

Blocked on specification PR #1175. Once merged, regenerate SDK types with npm run codegen.

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