Skip to content

Conversation

@robholland
Copy link
Contributor

What was changed

Added a DSL sample.

Checklist

  1. Closes Sample request: DSL workflow #32

  2. How was this tested:
    Run manually using README.

  1. Any docs updates needed?

@robholland robholland requested a review from a team as a code owner April 30, 2025 15:26
if input.is_a?(String)
# Run YAML parsing in an unsafe block since it's non-deterministic
Temporalio::Workflow::Unsafe.illegal_call_tracing_disabled do
require 'yaml'
Copy link
Member

@cretz cretz Apr 30, 2025

Choose a reason for hiding this comment

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

I think we should add this dependency in the Gemfile, and say it's part of group :dsl. I think the require should be at the top of the file (though as mentioned in another comment, workflow shouldn't have to know anything about YAML IMO in this sample, but can be discussed).

# Safely parse the input
def parse_input(input)
if input.is_a?(String)
# Run YAML parsing in an unsafe block since it's non-deterministic
Copy link
Member

Choose a reason for hiding this comment

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

I think YAML parsing needs to be done by caller and the workflow should accept a serializable model instead of a YAML string. The workflow shouldn't concern itself with the file format IMO. We should have the client do the parsing. I do understand this makes it easier for CLI, but I wonder if that should be an exercise left to the reader.

# frozen_string_literal: true

module Dsl
module Models
Copy link
Member

Choose a reason for hiding this comment

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

Module name and file name should match

end

# Parse YAML to DSL models
class Parser
Copy link
Member

Choose a reason for hiding this comment

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

Where is this class used?

futures.map(&:result)
end

def activity_name_to_class(name)
Copy link
Member

Choose a reason for hiding this comment

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

I'd just capitalize the names in the YAML and remove this conversion. No need for this extra code/complication in the sample IMO.

@cretz
Copy link
Member

cretz commented Oct 1, 2025

Went ahead and copied/rewrote this in #52

@cretz cretz closed this Oct 1, 2025
@cretz cretz deleted the rh-dsl branch October 1, 2025 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sample request: DSL workflow

3 participants