Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,10 @@ The Anatomy of Action Class
# every action needs to inherit from Dynflow::Action
class Action < Dynflow::Action

# OPTIONAL: the input format for the execution phase of this action
# (https://github.com/iNecas/apipie-params for more details.
# Validations can be performed against this description (turned off
# for now)
# OPTIONAL: the input format for the execution phase of this action.
# This is purely documentation - the block is never evaluated and
# serves only as a reference for developers implementing actions.
# Input validation is not performed.
input_format do
param :id, Integer
param :name, String
Expand Down
8 changes: 4 additions & 4 deletions doc/pages/source/documentation/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,12 +203,12 @@ class AnAction < Dynflow::Action
end
```

This might me quite handy especially in combination with
This might be quite handy especially in combination with
[subscriptions](#subscriptions) functionality.

The format follows [apipie-params](https://github.com/iNecas/apipie-params) for more details.
Validations of input/output could be performed against this description but it's not turned on
by default. (It needs to be revisited and updated to be fully functional.)
These format definitions are purely for documentation purposes - the blocks are never
evaluated and serve only as a reference for developers implementing actions.
Input/output validation is not performed.

{% endinfo_block %}

Expand Down
1 change: 0 additions & 1 deletion dynflow.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ Gem::Specification.new do |s|
s.required_ruby_version = '>= 2.7.0'

s.add_dependency "algebrick", '~> 0.7.0'
s.add_dependency "apipie-params"
s.add_dependency "concurrent-ruby", '~> 1.1.3'
s.add_dependency "concurrent-ruby-edge", '~> 0.6.0'
s.add_dependency "csv", "~> 3.1"
Expand Down
1 change: 0 additions & 1 deletion lib/dynflow.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# frozen_string_literal: true

require 'apipie-params'
require 'algebrick'
require 'set'
require 'base64'
Expand Down
37 changes: 4 additions & 33 deletions lib/dynflow/action/format.rb
Original file line number Diff line number Diff line change
@@ -1,44 +1,15 @@
# frozen_string_literal: true

module Dynflow
# Input/output format validation logic calling
# input_format/output_format with block acts as a setter for
# specifying the format. Without a block it acts as a getter
module Action::Format
# we don't evaluate tbe block immediatelly, but postpone it till all the
# action classes are loaded, because we can use them to reference output format
def input_format(&block)
case
when block && !@input_format_block
@input_format_block = block
when !block && @input_format_block
return @input_format ||= Apipie::Params::Description.define(&@input_format_block)
when block && @input_format_block
raise "The input_format has already been defined in #{self.class}"
when !block && !@input_format_block
if superclass.respond_to? :input_format
superclass.input_format
else
raise "The input_format has not been defined yet in #{self.class}"
end
end
# Format definitions are not validated
# This method is kept for backward compatibility but does nothing
end

def output_format(&block)
case
when block && !@output_format_block
@output_format_block = block
when !block && @output_format_block
return @output_format ||= Apipie::Params::Description.define(&@output_format_block)
when block && @output_format_block
raise "The output_format has already been defined in #{self.class}"
when !block && !@output_format_block
if superclass.respond_to? :output_format
superclass.output_format
else
raise "The output_format has not been defined yet in #{self.class}"
end
end
# Format definitions are not validated
# This method is kept for backward compatibility but does nothing
end
end
end
Loading