Module: Dry::Validation
- Extended by:
- Core::Extensions
- Defined in:
- lib/dry/validation.rb,
lib/dry/validation/result.rb,
lib/dry/validation/schema.rb,
lib/dry/validation/message.rb,
lib/dry/validation/version.rb,
lib/dry/validation/executor.rb,
lib/dry/validation/messages.rb,
lib/dry/validation/schema/dsl.rb,
lib/dry/validation/schema/key.rb,
lib/dry/validation/type_specs.rb,
lib/dry/validation/message_set.rb,
lib/dry/validation/schema/form.rb,
lib/dry/validation/schema/json.rb,
lib/dry/validation/schema/rule.rb,
lib/dry/validation/deprecations.rb,
lib/dry/validation/schema/check.rb,
lib/dry/validation/schema/value.rb,
lib/dry/validation/messages/i18n.rb,
lib/dry/validation/messages/yaml.rb,
lib/dry/validation/schema_compiler.rb,
lib/dry/validation/message_compiler.rb,
lib/dry/validation/extensions/monads.rb,
lib/dry/validation/extensions/struct.rb,
lib/dry/validation/messages/abstract.rb,
lib/dry/validation/schema/deprecated.rb,
lib/dry/validation/predicate_registry.rb,
lib/dry/validation/messages/namespaced.rb,
lib/dry/validation/schema/class_interface.rb,
lib/dry/validation/input_processor_compiler.rb,
lib/dry/validation/input_processor_compiler/form.rb,
lib/dry/validation/input_processor_compiler/json.rb,
lib/dry/validation/message_compiler/visitor_opts.rb,
lib/dry/validation/input_processor_compiler/sanitizer.rb
Defined Under Namespace
Modules: Deprecations, Messages, TypeSpecs
Classes: ApplyChecks, ApplyInputRule, ApplyRules, BuildErrors, Executor, Guard, Hint, InputProcessorCompiler, Message, MessageCompiler, MessageSet, PredicateRegistry, ProcessInput, Result, Schema, SchemaCompiler
Constant Summary
collapse
- MissingMessageError =
Class.new(StandardError)
- InvalidSchemaError =
Class.new(StandardError)
- VERSION =
'0.10.3'.freeze
Class Method Summary
collapse
Class Method Details
32
33
34
35
|
# File 'lib/dry/validation.rb', line 32
def self.Form(base = nil, **options, &block)
klass = base ? Schema::Form.configure(Class.new(base)) : Schema::Form
Validation.Schema(klass, options, &block)
end
|
.JSON(base = Schema::JSON, **options, &block) ⇒ Object
37
38
39
40
|
# File 'lib/dry/validation.rb', line 37
def self.JSON(base = Schema::JSON, **options, &block)
klass = base ? Schema::JSON.configure(Class.new(base)) : Schema::JSON
Validation.Schema(klass, options, &block)
end
|
.messages_paths ⇒ Object
17
18
19
|
# File 'lib/dry/validation.rb', line 17
def self.messages_paths
Messages::Abstract.config.paths
end
|
.Schema(base = Schema, **options, &block) ⇒ Object
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/dry/validation.rb', line 21
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
|