Sha256: 7a1c9b185d3cf73a9b5eb6a1e27ccb0a04f08f7c2fabb29d878d82027be213fe

Contents?: true

Size: 1.04 KB

Versions: 13

Compression:

Stored size: 1.04 KB

Contents

module Dry
  module Validation
    class InputProcessorCompiler::JSON < InputProcessorCompiler
      PREDICATE_MAP = {
        default: 'string',
        none?: 'json.nil',
        bool?: 'bool',
        str?: 'string',
        int?: 'int',
        float?: 'float',
        decimal?: 'json.decimal',
        date?: 'json.date',
        date_time?: 'json.date_time',
        time?: 'json.time'
      }.freeze

      CONST_MAP = {
        NilClass => 'nil',
        String => 'string',
        Fixnum => 'int',
        Integer => 'int',
        Float => 'float',
        BigDecimal => 'json.decimal',
        Array => 'json.array',
        Hash => 'json.hash',
        Date => 'json.date',
        DateTime => 'json.date_time',
        Time => 'json.time',
        TrueClass => 'true',
        FalseClass => 'false'
      }.freeze

      def identifier
        :json
      end

      def hash_node(schema)
        [:type, ['json.hash', [:symbolized, schema]]]
      end

      def array_node(members)
        [:type, ['json.array', members]]
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
dry-validation-0.10.4 lib/dry/validation/input_processor_compiler/json.rb
dry-validation-0.10.3 lib/dry/validation/input_processor_compiler/json.rb
dry-validation-0.10.2 lib/dry/validation/input_processor_compiler/json.rb
dry-validation-0.10.1 lib/dry/validation/input_processor_compiler/json.rb
dry-validation-0.10.0 lib/dry/validation/input_processor_compiler/json.rb
dry-validation-0.9.5 lib/dry/validation/input_processor_compiler/json.rb
dry-validation-0.9.4 lib/dry/validation/input_processor_compiler/json.rb
dry-validation-0.9.3 lib/dry/validation/input_processor_compiler/json.rb
dry-validation-0.9.2 lib/dry/validation/input_processor_compiler/json.rb
dry-validation-0.9.1 lib/dry/validation/input_processor_compiler/json.rb
dry-validation-0.9.0 lib/dry/validation/input_processor_compiler/json.rb
dry-validation-0.8.0 lib/dry/validation/input_processor_compiler/json.rb
dry-validation-0.7.4 lib/dry/validation/input_processor_compiler/json.rb