Sha256: cbb1dd3212be32d6a5c0f2c552726724deeb93d262b85ba5d1e39124941f9f8a
Contents?: true
Size: 753 Bytes
Versions: 3
Compression:
Stored size: 753 Bytes
Contents
# frozen_string_literal: true require 'trailblazer/operation/validate' module Pragma 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.#{name}"].errors.messages ).decorate_with(Pragma::Decorator::Error) end end end [step, name: "contract.#{name}.validate"] end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
pragma-2.4.0 | lib/pragma/macro/contract/validate.rb |
pragma-2.3.0 | lib/pragma/macro/contract/validate.rb |
pragma-2.2.0 | lib/pragma/macro/contract/validate.rb |