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/step.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/types_merger.rb,
lib/dry/schema/key_validator.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/extensions/info.rb,
lib/dry/schema/macros/optional.rb,
lib/dry/schema/macros/required.rb,
lib/dry/schema/namespaced_rule.rb,
lib/dry/schema/processor_steps.rb,
lib/dry/schema/extensions/hints.rb,
lib/dry/schema/message_compiler.rb,
lib/dry/schema/extensions/monads.rb,
lib/dry/schema/extensions/struct.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/message/or/abstract.rb,
lib/dry/schema/messages/namespaced.rb,
lib/dry/schema/message/or/multi_path.rb,
lib/dry/schema/extensions/json_schema.rb,
lib/dry/schema/message/or/single_path.rb,
lib/dry/schema/message_compiler/visitor_opts.rb,
lib/dry/schema/extensions/hints/result_methods.rb,
lib/dry/schema/extensions/info/schema_compiler.rb,
lib/dry/schema/extensions/hints/compiler_methods.rb,
lib/dry/schema/extensions/hints/message_set_methods.rb,
lib/dry/schema/extensions/json_schema/schema_compiler.rb,
lib/dry/schema/extensions/hints/message_compiler_methods.rb
Overview
Common constants used across the library
Defined Under Namespace
Modules: Extensions, Info, JSONSchema, Macros, Messages, Types Classes: Compiler, Config, DSL, Hint, JSON, Key, KeyCoercer, KeyMap, KeyValidator, Message, MessageCompiler, MessageSet, NamespacedRule, Params, Path, Predicate, PredicateInferrer, PredicateRegistry, PrimitiveInferrer, Processor, ProcessorSteps, Result, RuleApplier, Step, Trace, TypeContainer, TypeRegistry, TypesMerger, ValueCoercer
Constant Summary collapse
- VERSION =
"1.10.1"- LIST_SEPARATOR =
", "- QUESTION_MARK =
"?"- DOT =
"."- STEPS_IN_ORDER =
core processor steps in the default execution order
%i[ key_validator key_coercer filter_schema value_coercer rule_applier ].freeze
- 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, paths = []) *rest, rule = path super(<<~STR) Message template for #{rule.inspect} under #{rest.join(DOT).inspect} was not found. Searched in: #{paths.map { |string| "\"#{string}\"" }.join("\n")} STR end end
Class Method Summary collapse
-
.config ⇒ Config
Configuration.
-
.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
.config ⇒ Config
Configuration
28 29 30 |
# File 'lib/dry/schema.rb', line 28 def self.config @config ||= Config.new end |
.define(**options, &block) ⇒ Processor
Define a schema
47 48 49 |
# File 'lib/dry/schema.rb', line 47 def self.define(**, &block) DSL.new(**, &block).call end |