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
feat: Register workflow via WorkflowDefinition instead of raw callable (#37)
<!-- Describe what has changed in this PR -->
**What changed?**
- Added `WorkflowDefinition` class with type-safe wrapper for workflow
functions, including `.fn`, `.name`, and `.params` properties for
metadata access
- Registry now stores `WorkflowDefinition` internally instead of raw
callables, with `get_workflow()` returning the typed wrapper
- Introduced `WorkflowParameter` dataclass for parameter introspection
(name, type hints, defaults) and `@defn` decorator for standalone
workflow definition
<!-- Tell your future self why have you made these changes -->
**Why?**
- Enables compile-time type checking via mypy and better IDE support,
consistent with existing `ActivityDefinition` pattern
- Enables parameter validation, automatic API documentation, dynamic
workflow discovery, and better error messages
<!-- How have you verified this change? Tested locally? Added a unit
test? Checked in staging env? -->
**How did you test it?**
unit tests
<!-- Assuming the worst case, what can be broken when deploying this
change to production? -->
**Potential risks**
<!-- Is it notable for release? e.g. schema updates, configuration or
data migration required? If so, please mention it, and also update
CHANGELOG.md -->
**Release notes**
<!-- Is there any documentation updates should be made for config,
https://cadenceworkflow.io/docs/operation-guide/setup/ ? If so, please
open an PR in https://github.com/cadence-workflow/cadence-docs -->
**Documentation Changes**
---------
Signed-off-by: Tim Li <[email protected]>
0 commit comments