coinbase / coinbase/temporal-ruby
Typed input and output
- Dominant language
- Ruby
- Stars
- 287
- Forks
- 113
- Avg merge
- 6d 11h
- Merged PRs (30d)
- 1
Description
Hi! I am trying to get rid of `JSON.parse(input)` and `JSON.dump(output)` in activities/workflows and wanted to define Input and Output classes with dry-struct to define the structure.
Then I found this line in https://github.com/coinbase/temporal-ruby/blob/master/lib/temporal/concerns/typed.rb#L22
```ruby
unless klass.is_a?(Dry::Types::Type)
```
Now I am stuck on how to make reusable structs with validation for workflow/activity params. I have three questions:
1. Does it make sense to change condition in typed.rb to allow dry structs?
2. How I can add typed output, so I don't need to serialize and deserialize outputs multiple time?
3. Any best practices to validate inputs before activating the workflow?
Any ideas how to solve this?
Contributor guide
Assessment
This issue has not been assessed yet.