Sha256: 98ef31ffdc6134058b95aef0cac53f29a6823921d79fd767053fd21537c09b3a

Contents?: true

Size: 565 Bytes

Versions: 3

Compression:

Stored size: 565 Bytes

Contents

# frozen string literal: true

require 'dry-validation'
require 'spy_alley_application/types/nationality'

module SpyAlleyApplication
  module Validator
    class Move < Dry::Validation::Contract
      option :option, type: ::Types::ArrayOfStrictInteger.constrained(size: 2)

      params do
        required(:space_id).filled(::Types::Coercible::Integer)
      end

      rule(:space_id) do
        if !options.include?(values[:space_id])
          key.failure({text: "'#{values[:space_id]}' not allowable", status: 422})
        end
      end
    end
  end
end


Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spy_alley_application-0.3.2 lib/spy_alley_application/validator/move.rb
spy_alley_application-0.3.1 lib/spy_alley_application/validator/move.rb
spy_alley_application-0.3.0 lib/spy_alley_application/validator/move.rb