Skip to content

feat(core): adds support for extendable message schemas based on the cloudevents spec#52

Merged
dgoerdes merged 3 commits into
mainfrom
feature/extendable-cloudevent-schemas
Jul 1, 2026
Merged

feat(core): adds support for extendable message schemas based on the cloudevents spec#52
dgoerdes merged 3 commits into
mainfrom
feature/extendable-cloudevent-schemas

Conversation

@dgoerdes

@dgoerdes dgoerdes commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates Nimbus message factories and base Zod schemas to support CloudEvents extension attributes (e.g., metadata, authcontext) while adding warnings for invalid extension attribute names per the CloudEvents spec.

Changes:

  • Allow unknown/extension attributes to pass validation by switching base commandSchema / eventSchema / querySchema to loose objects.
  • Extend createCommand / createEvent / createQuery inputs to accept extension attributes and pass them through to the created message.
  • Add shared validation + new unit tests verifying extension passthrough and warning behavior.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
packages/eventsourcingdb/src/lib/eventMapping.ts Adjusts typing for event creation to align with updated createEvent input typing.
packages/core/src/lib/message/message.ts Introduces shared helper to warn on invalid CloudEvents extension attribute names.
packages/core/src/lib/message/command.ts Enables extension attributes in schema + factory, and adds validation warnings.
packages/core/src/lib/message/command.test.ts Adds tests for extension passthrough, validation, and warning behavior.
packages/core/src/lib/message/event.ts Enables extension attributes in schema + factory, and adds validation warnings.
packages/core/src/lib/message/event.test.ts Adds tests for extension passthrough, validation, and warning behavior.
packages/core/src/lib/message/query.ts Enables extension attributes in schema + factory, and adds validation warnings.
packages/core/src/lib/message/query.test.ts Adds tests for extension passthrough, validation, and warning behavior.
examples/eventsourcing-demo/src/write/iam/users/shell/http.ts Demonstrates passing auth context as an extension attribute in HTTP example.
examples/eventsourcing-demo/src/write/iam/users/core/commands/inviteUser.command.ts Demonstrates extending command schema with an auth context extension attribute.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/core/src/lib/message/command.ts
Comment thread packages/core/src/lib/message/event.ts
Comment thread packages/core/src/lib/message/query.ts
Comment thread examples/eventsourcing-demo/src/write/iam/users/shell/http.ts Outdated
@sonarqubecloud

sonarqubecloud Bot commented Jul 1, 2026

Copy link
Copy Markdown

@dgoerdes dgoerdes merged commit f6807f0 into main Jul 1, 2026
7 checks passed
@dgoerdes dgoerdes deleted the feature/extendable-cloudevent-schemas branch July 1, 2026 14:13
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants