Module: Dry::Schema
- Extended by:
- Core::Extensions
- Includes:
- Core::Constants
- Defined in:
- lib/dry/schema.rb,
lib/dry/schema/dsl.rb,
lib/dry/schema/key.rb,
lib/dry/schema/json.rb,
lib/dry/schema/path.rb,
lib/dry/schema/trace.rb,
lib/dry/schema/types.rb,
lib/dry/schema/config.rb,
lib/dry/schema/params.rb,
lib/dry/schema/result.rb,
lib/dry/schema/key_map.rb,
lib/dry/schema/message.rb,
lib/dry/schema/version.rb,
lib/dry/schema/compiler.rb,
lib/dry/schema/messages.rb,
lib/dry/schema/constants.rb,
lib/dry/schema/predicate.rb,
lib/dry/schema/processor.rb,
lib/dry/schema/macros/dsl.rb,
lib/dry/schema/macros/key.rb,
lib/dry/schema/message/or.rb,
lib/dry/schema/key_coercer.rb,
lib/dry/schema/macros/core.rb,
lib/dry/schema/macros/each.rb,
lib/dry/schema/macros/hash.rb,
lib/dry/schema/message_set.rb,
lib/dry/schema/macros/array.rb,
lib/dry/schema/macros/maybe.rb,
lib/dry/schema/macros/value.rb,
lib/dry/schema/rule_applier.rb,
lib/dry/schema/macros/filled.rb,
lib/dry/schema/macros/schema.rb,
lib/dry/schema/messages/i18n.rb,
lib/dry/schema/messages/yaml.rb,
lib/dry/schema/type_registry.rb,
lib/dry/schema/value_coercer.rb,
lib/dry/schema/type_container.rb,
lib/dry/schema/macros/optional.rb,
lib/dry/schema/macros/required.rb,
lib/dry/schema/namespaced_rule.rb,
lib/dry/schema/extensions/hints.rb,
lib/dry/schema/message_compiler.rb,
lib/dry/schema/extensions/monads.rb,
lib/dry/schema/messages/abstract.rb,
lib/dry/schema/messages/template.rb,
lib/dry/schema/predicate_inferrer.rb,
lib/dry/schema/predicate_registry.rb,
lib/dry/schema/primitive_inferrer.rb,
lib/dry/schema/messages/namespaced.rb,
lib/dry/schema/message_compiler/visitor_opts.rb,
lib/dry/schema/extensions/hints/result_methods.rb,
lib/dry/schema/extensions/hints/compiler_methods.rb,
lib/dry/schema/extensions/hints/message_set_methods.rb,
lib/dry/schema/extensions/hints/message_compiler_methods.rb
Overview
Common constants used across the library
Defined Under Namespace
Modules: Extensions, Macros, Messages, Types Classes: Compiler, Config, DSL, Hint, JSON, Key, KeyCoercer, KeyMap, Message, MessageCompiler, MessageSet, NamespacedRule, Params, Path, Predicate, PredicateInferrer, PredicateRegistry, PrimitiveInferrer, Processor, Result, RuleApplier, Trace, TypeContainer, TypeRegistry, ValueCoercer
Constant Summary collapse
- VERSION =
'1.3.2'
- LIST_SEPARATOR =
', '
- QUESTION_MARK =
'?'
- DOT =
'.'
- DEFAULT_MESSAGES_PATH =
Path to the default set of localized messages bundled within the gem
Pathname(__dir__).join('../../../config/errors.yml').realpath.freeze
- DEFAULT_MESSAGES_ROOT =
Default namespace used for localized messages in YAML files
'dry_schema'
- InvalidSchemaError =
An error raised when DSL is used in an incorrect way
Class.new(StandardError)
- MissingMessageError =
An error raised when a localized message cannot be found
Class.new(StandardError) do # @api private def initialize(path) *rest, rule = path super(<<~STR) Message template for #{rule.inspect} under #{rest.join(DOT).inspect} was not found STR end end
Class Method Summary collapse
-
.define(**options, &block) ⇒ Processor
Define a schema.
-
.JSON(**options, &block) ⇒ Params
Define a schema suitable for JSON data.
-
.Params(**options, &block) ⇒ Params
Define a schema suitable for HTTP params.
Class Method Details
.define(**options, &block) ⇒ Processor
Define a schema
32 33 34 |
# File 'lib/dry/schema.rb', line 32 def self.define(**, &block) DSL.new(, &block).call end |