lib/dry/schema.rb in dry-schema-1.4.3 vs lib/dry/schema.rb in dry-schema-1.5.0
- old
+ new
@@ -1,21 +1,34 @@
# frozen_string_literal: true
-require 'dry/core/extensions'
+require "dry/core/extensions"
-require 'dry/schema/constants'
-require 'dry/schema/dsl'
-require 'dry/schema/params'
-require 'dry/schema/json'
+require "dry/schema/config"
+require "dry/schema/constants"
+require "dry/schema/dsl"
+require "dry/schema/params"
+require "dry/schema/json"
module Dry
# Main interface
#
# @api public
module Schema
extend Dry::Core::Extensions
+ # Configuration
+ #
+ # @example
+ # Dry::Schema.config.messages.backend = :i18n
+ #
+ # @return [Config]
+ #
+ # @api public
+ def self.config
+ @config ||= Config.new
+ end
+
# Define a schema
#
# @example
# Dry::Schema.define do
# required(:name).filled(:string)
@@ -72,6 +85,6 @@
define(**options, processor_type: JSON, &block)
end
end
end
-require 'dry/schema/extensions'
+require "dry/schema/extensions"