Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

dry-validation now raises if the argument isn't a Hash. Fix 1/n

Marcello Rocha85aba0dccee0
diff --git a/app/models/types/patterns/collection.rb b/app/models/types/patterns/collection.rb
index 990a7b9413c..e1dda360e4c 100644
--- a/app/models/types/patterns/collection.rb
+++ b/app/models/types/patterns/collection.rb
@@ -31,10 +31,13 @@
module Types
module Patterns
Collection = Data.define(:patterns) do
+ extend Dry::Monads[:result]
private_class_method :new
def self.build(patterns:, contract: CollectionContract.new)
contract.call(patterns).to_monad.fmap { |success| new(success.to_h) }
+ rescue ArgumentError => e
+ Failure(e)
end
def initialize(patterns:)