Sha256: 41fc44eca1f025c56960b8a31a769c94e765982554b6451f6a6a6ff9d839859a
Contents?: true
Size: 814 Bytes
Versions: 3
Compression:
Stored size: 814 Bytes
Contents
# frozen_string_literal: true require 'trailblazer/operation/validate' module Pragma module Operation module Macro module Contract def self.Validate(name: 'default', **args) step = lambda do |input, options| Trailblazer::Operation::Pipetree::Step.new( Trailblazer::Operation::Contract::Validate(**args).first ).call(input, options).tap do |result| unless result options['result.response'] = Pragma::Operation::Response::UnprocessableEntity.new( errors: options['contract.default'].errors.messages ).decorate_with(Pragma::Decorator::Error) end end end [step, name: "contract.#{name}.validate"] end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
pragma-2.1.1 | lib/pragma/operation/macro/contract/validate.rb |
pragma-2.1.0 | lib/pragma/operation/macro/contract/validate.rb |
pragma-2.0.0 | lib/pragma/operation/macro/contract/validate.rb |