Sha256: b0178d71927c113dcdde1ad59e780426fa1a1cb344d26117a6d280a04e933cd9
Contents?: true
Size: 1.18 KB
Versions: 8
Compression:
Stored size: 1.18 KB
Contents
require 'dry/core/extensions' require 'dry/core/constants' module Dry module Validation extend Dry::Core::Extensions include Dry::Core::Constants MissingMessageError = Class.new(StandardError) InvalidSchemaError = Class.new(StandardError) def self.messages_paths Messages::Abstract.config.paths end def self.Schema(base = Schema, **options, &block) schema_class = Class.new(base.is_a?(Schema) ? base.class : base) klass = schema_class.define(options.merge(schema_class: schema_class), &block) if options[:build] == false klass else klass.new end end def self.Params(base = nil, **options, &block) klass = base ? Schema::Params.configure(Class.new(base)) : Schema::Params Validation.Schema(klass, options, &block) end def self.JSON(base = Schema::JSON, **options, &block) klass = base ? Schema::JSON.configure(Class.new(base)) : Schema::JSON Validation.Schema(klass, options, &block) end end end require 'dry/validation/schema' require 'dry/validation/schema/params' require 'dry/validation/schema/json' require 'dry/validation/extensions' require 'dry/validation/version'
Version data entries
8 entries across 8 versions & 1 rubygems