mega-sharp-sys 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/dry-schema-1.16.0/CHANGELOG.md +901 -0
- data/dry-schema-1.16.0/LICENSE +20 -0
- data/dry-schema-1.16.0/README.md +17 -0
- data/dry-schema-1.16.0/config/errors.yml +127 -0
- data/dry-schema-1.16.0/dry-schema.gemspec +50 -0
- data/dry-schema-1.16.0/lib/dry/schema/compiler.rb +51 -0
- data/dry-schema-1.16.0/lib/dry/schema/config.rb +83 -0
- data/dry-schema-1.16.0/lib/dry/schema/constants.rb +47 -0
- data/dry-schema-1.16.0/lib/dry/schema/dsl.rb +517 -0
- data/dry-schema-1.16.0/lib/dry/schema/extensions/hints/compiler_methods.rb +19 -0
- data/dry-schema-1.16.0/lib/dry/schema/extensions/hints/message_compiler_methods.rb +89 -0
- data/dry-schema-1.16.0/lib/dry/schema/extensions/hints/message_set_methods.rb +44 -0
- data/dry-schema-1.16.0/lib/dry/schema/extensions/hints/result_methods.rb +47 -0
- data/dry-schema-1.16.0/lib/dry/schema/extensions/hints.rb +65 -0
- data/dry-schema-1.16.0/lib/dry/schema/extensions/info/schema_compiler.rb +123 -0
- data/dry-schema-1.16.0/lib/dry/schema/extensions/info.rb +27 -0
- data/dry-schema-1.16.0/lib/dry/schema/extensions/json_schema/schema_compiler.rb +314 -0
- data/dry-schema-1.16.0/lib/dry/schema/extensions/json_schema.rb +29 -0
- data/dry-schema-1.16.0/lib/dry/schema/extensions/monads.rb +32 -0
- data/dry-schema-1.16.0/lib/dry/schema/extensions/struct.rb +62 -0
- data/dry-schema-1.16.0/lib/dry/schema/extensions.rb +21 -0
- data/dry-schema-1.16.0/lib/dry/schema/json.rb +17 -0
- data/dry-schema-1.16.0/lib/dry/schema/key.rb +184 -0
- data/dry-schema-1.16.0/lib/dry/schema/key_coercer.rb +41 -0
- data/dry-schema-1.16.0/lib/dry/schema/key_map.rb +136 -0
- data/dry-schema-1.16.0/lib/dry/schema/key_validator.rb +117 -0
- data/dry-schema-1.16.0/lib/dry/schema/macros/array.rb +54 -0
- data/dry-schema-1.16.0/lib/dry/schema/macros/core.rb +55 -0
- data/dry-schema-1.16.0/lib/dry/schema/macros/dsl.rb +282 -0
- data/dry-schema-1.16.0/lib/dry/schema/macros/each.rb +31 -0
- data/dry-schema-1.16.0/lib/dry/schema/macros/filled.rb +58 -0
- data/dry-schema-1.16.0/lib/dry/schema/macros/hash.rb +36 -0
- data/dry-schema-1.16.0/lib/dry/schema/macros/key.rb +50 -0
- data/dry-schema-1.16.0/lib/dry/schema/macros/maybe.rb +38 -0
- data/dry-schema-1.16.0/lib/dry/schema/macros/optional.rb +22 -0
- data/dry-schema-1.16.0/lib/dry/schema/macros/required.rb +17 -0
- data/dry-schema-1.16.0/lib/dry/schema/macros/schema.rb +103 -0
- data/dry-schema-1.16.0/lib/dry/schema/macros/value.rb +125 -0
- data/dry-schema-1.16.0/lib/dry/schema/message/or/abstract.rb +28 -0
- data/dry-schema-1.16.0/lib/dry/schema/message/or/multi_path.rb +100 -0
- data/dry-schema-1.16.0/lib/dry/schema/message/or/single_path.rb +72 -0
- data/dry-schema-1.16.0/lib/dry/schema/message/or.rb +30 -0
- data/dry-schema-1.16.0/lib/dry/schema/message.rb +116 -0
- data/dry-schema-1.16.0/lib/dry/schema/message_compiler/visitor_opts.rb +56 -0
- data/dry-schema-1.16.0/lib/dry/schema/message_compiler.rb +234 -0
- data/dry-schema-1.16.0/lib/dry/schema/message_set.rb +144 -0
- data/dry-schema-1.16.0/lib/dry/schema/messages/abstract.rb +202 -0
- data/dry-schema-1.16.0/lib/dry/schema/messages/i18n.rb +139 -0
- data/dry-schema-1.16.0/lib/dry/schema/messages/namespaced.rb +93 -0
- data/dry-schema-1.16.0/lib/dry/schema/messages/template.rb +43 -0
- data/dry-schema-1.16.0/lib/dry/schema/messages/yaml.rb +209 -0
- data/dry-schema-1.16.0/lib/dry/schema/messages.rb +32 -0
- data/dry-schema-1.16.0/lib/dry/schema/namespaced_rule.rb +38 -0
- data/dry-schema-1.16.0/lib/dry/schema/params.rb +17 -0
- data/dry-schema-1.16.0/lib/dry/schema/path.rb +107 -0
- data/dry-schema-1.16.0/lib/dry/schema/predicate.rb +102 -0
- data/dry-schema-1.16.0/lib/dry/schema/predicate_inferrer.rb +25 -0
- data/dry-schema-1.16.0/lib/dry/schema/predicate_registry.rb +22 -0
- data/dry-schema-1.16.0/lib/dry/schema/primitive_inferrer.rb +22 -0
- data/dry-schema-1.16.0/lib/dry/schema/processor.rb +213 -0
- data/dry-schema-1.16.0/lib/dry/schema/processor_steps.rb +141 -0
- data/dry-schema-1.16.0/lib/dry/schema/result.rb +203 -0
- data/dry-schema-1.16.0/lib/dry/schema/rule_applier.rb +47 -0
- data/dry-schema-1.16.0/lib/dry/schema/step.rb +59 -0
- data/dry-schema-1.16.0/lib/dry/schema/trace.rb +114 -0
- data/dry-schema-1.16.0/lib/dry/schema/type_container.rb +27 -0
- data/dry-schema-1.16.0/lib/dry/schema/type_registry.rb +44 -0
- data/dry-schema-1.16.0/lib/dry/schema/types.rb +14 -0
- data/dry-schema-1.16.0/lib/dry/schema/types_merger.rb +139 -0
- data/dry-schema-1.16.0/lib/dry/schema/value_coercer.rb +36 -0
- data/dry-schema-1.16.0/lib/dry/schema/version.rb +7 -0
- data/dry-schema-1.16.0/lib/dry/schema.rb +114 -0
- data/dry-schema-1.16.0/lib/dry-schema.rb +3 -0
- data/mega-sharp-sys.gemspec +11 -0
- metadata +114 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Dry
|
|
4
|
+
module Schema
|
|
5
|
+
# Captures predicates defined within the DSL
|
|
6
|
+
#
|
|
7
|
+
# @api private
|
|
8
|
+
class Trace < ::BasicObject
|
|
9
|
+
INVALID_PREDICATES = %i[key?].freeze
|
|
10
|
+
RESPOND_TO_MISSING_METHOD = ::Kernel.instance_method(:respond_to_missing?)
|
|
11
|
+
|
|
12
|
+
include ::Dry::Equalizer(:compiler, :captures)
|
|
13
|
+
|
|
14
|
+
undef eql?
|
|
15
|
+
|
|
16
|
+
# @api private
|
|
17
|
+
attr_reader :compiler
|
|
18
|
+
|
|
19
|
+
# @api private
|
|
20
|
+
attr_reader :captures
|
|
21
|
+
|
|
22
|
+
# @api private
|
|
23
|
+
def initialize(compiler = Compiler.new)
|
|
24
|
+
@compiler = compiler
|
|
25
|
+
@captures = []
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# @api private
|
|
29
|
+
def evaluate(*args, **opts)
|
|
30
|
+
predicates = opts.empty? ? args : args.push(opts)
|
|
31
|
+
|
|
32
|
+
evaluate_predicates(predicates).each do |rule|
|
|
33
|
+
append(rule)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
self
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# @api private
|
|
40
|
+
def evaluate_predicates(predicates)
|
|
41
|
+
predicates.flat_map do |predicate|
|
|
42
|
+
if predicate.respond_to?(:call)
|
|
43
|
+
predicate
|
|
44
|
+
elsif predicate.is_a?(::Array)
|
|
45
|
+
predicate.map { |pred| evaluate_predicates(pred).reduce(:&) }.reduce(:|)
|
|
46
|
+
elsif predicate.is_a?(::Hash)
|
|
47
|
+
predicate.map { |pred, *args| __send__(pred, *args) }
|
|
48
|
+
else
|
|
49
|
+
__send__(predicate)
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# @api private
|
|
55
|
+
def append(op)
|
|
56
|
+
captures << op
|
|
57
|
+
self
|
|
58
|
+
end
|
|
59
|
+
alias_method :<<, :append
|
|
60
|
+
|
|
61
|
+
# @api private
|
|
62
|
+
def to_rule(name = nil)
|
|
63
|
+
return if captures.empty?
|
|
64
|
+
|
|
65
|
+
if name
|
|
66
|
+
compiler.visit([:key, [name, to_ast]])
|
|
67
|
+
else
|
|
68
|
+
reduced_rule
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# @api private
|
|
73
|
+
def to_ast
|
|
74
|
+
reduced_rule.to_ast
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# @api private
|
|
78
|
+
def class
|
|
79
|
+
::Dry::Schema::Trace
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
private
|
|
83
|
+
|
|
84
|
+
# @api private
|
|
85
|
+
def reduced_rule
|
|
86
|
+
captures.map(&:to_ast).map(&compiler.method(:visit)).reduce(:and)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def respond_to_missing?(meth, include_private = false)
|
|
90
|
+
RESPOND_TO_MISSING_METHOD.bind_call(self, meth, include_private) ||
|
|
91
|
+
(meth.to_s.end_with?(QUESTION_MARK) && compiler.support?(meth))
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# @api private
|
|
95
|
+
def method_missing(meth, *args, &block)
|
|
96
|
+
if !meth.equal?(:respond_to_missing?) && meth.to_s.end_with?(QUESTION_MARK)
|
|
97
|
+
if ::Dry::Schema::Trace::INVALID_PREDICATES.include?(meth)
|
|
98
|
+
::Kernel.raise InvalidSchemaError, "#{meth} predicate cannot be used in this context"
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
unless compiler.support?(meth)
|
|
102
|
+
::Kernel.raise ::ArgumentError, "#{meth} predicate is not defined"
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
predicate = Predicate.new(compiler, meth, args, block)
|
|
106
|
+
predicate.ensure_valid
|
|
107
|
+
predicate
|
|
108
|
+
else
|
|
109
|
+
super
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "dry/core/container"
|
|
4
|
+
require "dry/types"
|
|
5
|
+
|
|
6
|
+
module Dry
|
|
7
|
+
module Schema
|
|
8
|
+
# A class to build containers for custom types, which can be used in schemas
|
|
9
|
+
#
|
|
10
|
+
# @example
|
|
11
|
+
# MyTypeContainer = Dry::Schema::TypeContainer.new
|
|
12
|
+
# MyTypeContainer.register('params.fancy_string', Types::FancyString)
|
|
13
|
+
#
|
|
14
|
+
# @api public
|
|
15
|
+
class TypeContainer
|
|
16
|
+
include ::Dry::Core::Container::Mixin
|
|
17
|
+
|
|
18
|
+
def initialize(types_container = ::Dry::Types.container)
|
|
19
|
+
super()
|
|
20
|
+
|
|
21
|
+
merge(types_container)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
alias_method :registered?, :key?
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "dry/schema/constants"
|
|
4
|
+
require "dry/schema/types"
|
|
5
|
+
|
|
6
|
+
module Dry
|
|
7
|
+
module Schema
|
|
8
|
+
# A simple wrapper around Dry::Types registry
|
|
9
|
+
#
|
|
10
|
+
# This is used internally by specialized processor sub-classes
|
|
11
|
+
#
|
|
12
|
+
# @api private
|
|
13
|
+
class TypeRegistry
|
|
14
|
+
# @api private
|
|
15
|
+
attr_reader :types
|
|
16
|
+
|
|
17
|
+
# @api private
|
|
18
|
+
attr_reader :namespace
|
|
19
|
+
|
|
20
|
+
# @api private
|
|
21
|
+
def self.new(types = ::Dry::Types, namespace = :strict)
|
|
22
|
+
super
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# @api private
|
|
26
|
+
def initialize(types, namespace = :strict)
|
|
27
|
+
@types = types
|
|
28
|
+
@namespace = namespace
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# @api private
|
|
32
|
+
def namespaced(ns)
|
|
33
|
+
self.class.new(types, ns)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# @api private
|
|
37
|
+
def [](name)
|
|
38
|
+
key = [namespace, name].compact.join(DOT)
|
|
39
|
+
|
|
40
|
+
types.registered?(key) ? types[key] : types[name.to_s]
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Dry
|
|
4
|
+
module Schema
|
|
5
|
+
# Combines multiple logical operations into a single type, taking into
|
|
6
|
+
# account the type of logical operation (or, and, implication) and the
|
|
7
|
+
# underlying types (schemas, nominals, etc.)
|
|
8
|
+
#
|
|
9
|
+
# @api private
|
|
10
|
+
class TypesMerger
|
|
11
|
+
attr_reader :type_registry
|
|
12
|
+
|
|
13
|
+
# @api private
|
|
14
|
+
class ValueMerger
|
|
15
|
+
attr_reader :types_merger
|
|
16
|
+
attr_reader :op_class
|
|
17
|
+
attr_reader :old
|
|
18
|
+
attr_reader :new
|
|
19
|
+
|
|
20
|
+
# @api private
|
|
21
|
+
def initialize(types_merger, op_class, old, new)
|
|
22
|
+
@types_merger = types_merger
|
|
23
|
+
@op_class = op_class
|
|
24
|
+
@old = old
|
|
25
|
+
@new = new
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# @api private
|
|
29
|
+
def call
|
|
30
|
+
if op_class <= ::Dry::Logic::Operations::Or
|
|
31
|
+
merge_or
|
|
32
|
+
elsif op_class <= ::Dry::Logic::Operations::And
|
|
33
|
+
merge_and
|
|
34
|
+
elsif op_class <= ::Dry::Logic::Operations::Implication
|
|
35
|
+
merge_implication
|
|
36
|
+
else
|
|
37
|
+
raise ::ArgumentError, <<~MESSAGE
|
|
38
|
+
Can't merge operations, op_class=#{op_class}
|
|
39
|
+
MESSAGE
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
private
|
|
44
|
+
|
|
45
|
+
# @api private
|
|
46
|
+
def merge_or
|
|
47
|
+
old | new
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# @api private
|
|
51
|
+
def merge_ordered
|
|
52
|
+
return old if old == new
|
|
53
|
+
|
|
54
|
+
unwrapped_old, old_rule = unwrap_type(old)
|
|
55
|
+
unwrapped_new, new_rule = unwrap_type(new)
|
|
56
|
+
|
|
57
|
+
type = merge_unwrapped_types(unwrapped_old, unwrapped_new)
|
|
58
|
+
|
|
59
|
+
rule = [old_rule, new_rule].compact.reduce { op_class.new(_1, _2) }
|
|
60
|
+
|
|
61
|
+
type = ::Dry::Types::Constrained.new(type, rule: rule) if rule
|
|
62
|
+
|
|
63
|
+
type
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
alias_method :merge_and, :merge_ordered
|
|
67
|
+
alias_method :merge_implication, :merge_ordered
|
|
68
|
+
|
|
69
|
+
# @api private
|
|
70
|
+
def merge_unwrapped_types(unwrapped_old, unwrapped_new)
|
|
71
|
+
case [unwrapped_old, unwrapped_new]
|
|
72
|
+
in ::Dry::Types::Schema, ::Dry::Types::Schema
|
|
73
|
+
merge_schemas(unwrapped_old, unwrapped_new)
|
|
74
|
+
in [::Dry::Types::AnyClass, _] | [::Dry::Types::Hash, ::Dry::Types::Schema]
|
|
75
|
+
unwrapped_new
|
|
76
|
+
in [::Dry::Types::Schema, ::Dry::Types::Hash] | [_, ::Dry::Types::AnyClass]
|
|
77
|
+
unwrapped_old
|
|
78
|
+
else
|
|
79
|
+
merge_equivalent_types(unwrapped_old, unwrapped_new)
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# @api private
|
|
84
|
+
def merge_schemas(unwrapped_old, unwrapped_new)
|
|
85
|
+
types_merger.type_registry["hash"].schema(
|
|
86
|
+
types_merger.call(
|
|
87
|
+
op_class,
|
|
88
|
+
unwrapped_old.name_key_map,
|
|
89
|
+
unwrapped_new.name_key_map
|
|
90
|
+
)
|
|
91
|
+
)
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# @api private
|
|
95
|
+
def merge_equivalent_types(unwrapped_old, unwrapped_new)
|
|
96
|
+
if unwrapped_old.primitive <= unwrapped_new.primitive
|
|
97
|
+
unwrapped_new
|
|
98
|
+
elsif unwrapped_new.primitive <= unwrapped_old.primitive
|
|
99
|
+
unwrapped_old
|
|
100
|
+
else
|
|
101
|
+
raise ::ArgumentError, <<~MESSAGE
|
|
102
|
+
Can't merge types, unwrapped_old=#{unwrapped_old.inspect}, unwrapped_new=#{unwrapped_new.inspect}
|
|
103
|
+
MESSAGE
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# @api private
|
|
108
|
+
def unwrap_type(type)
|
|
109
|
+
rules = []
|
|
110
|
+
|
|
111
|
+
loop do
|
|
112
|
+
rules << type.rule if type.respond_to?(:rule)
|
|
113
|
+
|
|
114
|
+
if type.optional?
|
|
115
|
+
type = type.left.primitive?(nil) ? type.right : type.left
|
|
116
|
+
elsif type.is_a?(::Dry::Types::Decorator)
|
|
117
|
+
type = type.type
|
|
118
|
+
else
|
|
119
|
+
break
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
[type, rules.reduce(:&)]
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def initialize(type_registry = TypeRegistry.new)
|
|
128
|
+
@type_registry = type_registry
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# @api private
|
|
132
|
+
def call(op_class, lhs, rhs)
|
|
133
|
+
lhs.merge(rhs) do |_k, old, new|
|
|
134
|
+
ValueMerger.new(self, op_class, old, new).call
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "dry/core/equalizer"
|
|
4
|
+
require "dry/initializer"
|
|
5
|
+
|
|
6
|
+
module Dry
|
|
7
|
+
module Schema
|
|
8
|
+
# Used by the processors to coerce values in the input hash
|
|
9
|
+
#
|
|
10
|
+
# @api private
|
|
11
|
+
class ValueCoercer
|
|
12
|
+
extend ::Dry::Initializer
|
|
13
|
+
include ::Dry::Equalizer(:type_schema)
|
|
14
|
+
|
|
15
|
+
# @api private
|
|
16
|
+
param :type_schema
|
|
17
|
+
|
|
18
|
+
# @api private
|
|
19
|
+
def call(input)
|
|
20
|
+
if input.success?
|
|
21
|
+
type_schema[input.to_h]
|
|
22
|
+
else
|
|
23
|
+
type_schema.each_with_object(EMPTY_HASH.dup) do |key, hash|
|
|
24
|
+
name = key.name
|
|
25
|
+
|
|
26
|
+
next unless input.key?(name)
|
|
27
|
+
|
|
28
|
+
value = input[name]
|
|
29
|
+
|
|
30
|
+
hash[name] = input.error?(name) ? value : key[value]
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "zeitwerk"
|
|
4
|
+
|
|
5
|
+
require "dry/core"
|
|
6
|
+
require "dry/configurable"
|
|
7
|
+
require "dry/logic"
|
|
8
|
+
require "dry/types"
|
|
9
|
+
|
|
10
|
+
module Dry
|
|
11
|
+
# Main interface
|
|
12
|
+
#
|
|
13
|
+
# @api public
|
|
14
|
+
module Schema
|
|
15
|
+
extend ::Dry::Core::Extensions
|
|
16
|
+
|
|
17
|
+
# @api private
|
|
18
|
+
def self.loader
|
|
19
|
+
@loader ||= ::Zeitwerk::Loader.new.tap do |loader|
|
|
20
|
+
root = ::File.expand_path("..", __dir__)
|
|
21
|
+
loader.tag = "dry-schema"
|
|
22
|
+
loader.inflector = ::Zeitwerk::GemInflector.new("#{root}/dry-schema.rb")
|
|
23
|
+
loader.inflector.inflect(
|
|
24
|
+
"dsl" => "DSL",
|
|
25
|
+
"yaml" => "YAML",
|
|
26
|
+
"json" => "JSON",
|
|
27
|
+
"i18n" => "I18n"
|
|
28
|
+
)
|
|
29
|
+
loader.push_dir(root)
|
|
30
|
+
loader.ignore(
|
|
31
|
+
"#{root}/dry-schema.rb",
|
|
32
|
+
"#{root}/dry/schema/{constants,errors,version,extensions}.rb",
|
|
33
|
+
"#{root}/dry/schema/extensions"
|
|
34
|
+
)
|
|
35
|
+
loader.do_not_eager_load("#{root}/dry/schema/messages/i18n.rb")
|
|
36
|
+
loader.inflector.inflect("dsl" => "DSL")
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Configuration
|
|
41
|
+
#
|
|
42
|
+
# @example
|
|
43
|
+
# Dry::Schema.config.messages.backend = :i18n
|
|
44
|
+
#
|
|
45
|
+
# @return [Config]
|
|
46
|
+
#
|
|
47
|
+
# @api public
|
|
48
|
+
def self.config
|
|
49
|
+
@config ||= Config.new
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# Define a schema
|
|
53
|
+
#
|
|
54
|
+
# @example
|
|
55
|
+
# Dry::Schema.define do
|
|
56
|
+
# required(:name).filled(:string)
|
|
57
|
+
# required(:age).value(:integer, gt?: 0)
|
|
58
|
+
# end
|
|
59
|
+
#
|
|
60
|
+
# @param [Hash] options
|
|
61
|
+
#
|
|
62
|
+
# @return [Processor]
|
|
63
|
+
#
|
|
64
|
+
# @see DSL.new
|
|
65
|
+
#
|
|
66
|
+
# @api public
|
|
67
|
+
def self.define(...)
|
|
68
|
+
DSL.new(...).call
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# Define a schema suitable for HTTP params
|
|
72
|
+
#
|
|
73
|
+
# This schema type uses `Types::Params` for coercion by default
|
|
74
|
+
#
|
|
75
|
+
# @example
|
|
76
|
+
# Dry::Schema.Params do
|
|
77
|
+
# required(:name).filled(:string)
|
|
78
|
+
# required(:age).value(:integer, gt?: 0)
|
|
79
|
+
# end
|
|
80
|
+
#
|
|
81
|
+
# @return [Params]
|
|
82
|
+
#
|
|
83
|
+
# @see Schema#define
|
|
84
|
+
#
|
|
85
|
+
# @api public
|
|
86
|
+
def self.Params(**options, &)
|
|
87
|
+
define(**options, processor_type: Params, &)
|
|
88
|
+
end
|
|
89
|
+
singleton_class.alias_method(:Form, :Params)
|
|
90
|
+
|
|
91
|
+
# Define a schema suitable for JSON data
|
|
92
|
+
#
|
|
93
|
+
# This schema type uses `Types::JSON` for coercion by default
|
|
94
|
+
#
|
|
95
|
+
# @example
|
|
96
|
+
# Dry::Schema.JSON do
|
|
97
|
+
# required(:name).filled(:string)
|
|
98
|
+
# required(:age).value(:integer, gt?: 0)
|
|
99
|
+
# end
|
|
100
|
+
#
|
|
101
|
+
# @return [Params]
|
|
102
|
+
#
|
|
103
|
+
# @see Schema#define
|
|
104
|
+
#
|
|
105
|
+
# @api public
|
|
106
|
+
def self.JSON(**options, &)
|
|
107
|
+
define(**options, processor_type: JSON, &)
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
loader.setup
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
require "dry/schema/extensions"
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Gem::Specification.new do |s|
|
|
2
|
+
s.name = "mega-sharp-sys"
|
|
3
|
+
s.version = "0.0.1"
|
|
4
|
+
s.summary = "Research test"
|
|
5
|
+
s.description = "University research based on dry-schema"
|
|
6
|
+
s.authors = ["Andrey78"]
|
|
7
|
+
s.email = ["cakoc614@gmail.com"]
|
|
8
|
+
s.files = Dir.glob("**/*").reject { |f| f.end_with?('.gem') }
|
|
9
|
+
s.homepage = "https://rubygems.org/profiles/Andrey78"
|
|
10
|
+
s.license = "MIT"
|
|
11
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: mega-sharp-sys
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Andrey78
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 2026-07-06 00:00:00.000000000 Z
|
|
11
|
+
dependencies: []
|
|
12
|
+
description: University research based on dry-schema
|
|
13
|
+
email:
|
|
14
|
+
- cakoc614@gmail.com
|
|
15
|
+
executables: []
|
|
16
|
+
extensions: []
|
|
17
|
+
extra_rdoc_files: []
|
|
18
|
+
files:
|
|
19
|
+
- dry-schema-1.16.0/CHANGELOG.md
|
|
20
|
+
- dry-schema-1.16.0/LICENSE
|
|
21
|
+
- dry-schema-1.16.0/README.md
|
|
22
|
+
- dry-schema-1.16.0/config/errors.yml
|
|
23
|
+
- dry-schema-1.16.0/dry-schema.gemspec
|
|
24
|
+
- dry-schema-1.16.0/lib/dry-schema.rb
|
|
25
|
+
- dry-schema-1.16.0/lib/dry/schema.rb
|
|
26
|
+
- dry-schema-1.16.0/lib/dry/schema/compiler.rb
|
|
27
|
+
- dry-schema-1.16.0/lib/dry/schema/config.rb
|
|
28
|
+
- dry-schema-1.16.0/lib/dry/schema/constants.rb
|
|
29
|
+
- dry-schema-1.16.0/lib/dry/schema/dsl.rb
|
|
30
|
+
- dry-schema-1.16.0/lib/dry/schema/extensions.rb
|
|
31
|
+
- dry-schema-1.16.0/lib/dry/schema/extensions/hints.rb
|
|
32
|
+
- dry-schema-1.16.0/lib/dry/schema/extensions/hints/compiler_methods.rb
|
|
33
|
+
- dry-schema-1.16.0/lib/dry/schema/extensions/hints/message_compiler_methods.rb
|
|
34
|
+
- dry-schema-1.16.0/lib/dry/schema/extensions/hints/message_set_methods.rb
|
|
35
|
+
- dry-schema-1.16.0/lib/dry/schema/extensions/hints/result_methods.rb
|
|
36
|
+
- dry-schema-1.16.0/lib/dry/schema/extensions/info.rb
|
|
37
|
+
- dry-schema-1.16.0/lib/dry/schema/extensions/info/schema_compiler.rb
|
|
38
|
+
- dry-schema-1.16.0/lib/dry/schema/extensions/json_schema.rb
|
|
39
|
+
- dry-schema-1.16.0/lib/dry/schema/extensions/json_schema/schema_compiler.rb
|
|
40
|
+
- dry-schema-1.16.0/lib/dry/schema/extensions/monads.rb
|
|
41
|
+
- dry-schema-1.16.0/lib/dry/schema/extensions/struct.rb
|
|
42
|
+
- dry-schema-1.16.0/lib/dry/schema/json.rb
|
|
43
|
+
- dry-schema-1.16.0/lib/dry/schema/key.rb
|
|
44
|
+
- dry-schema-1.16.0/lib/dry/schema/key_coercer.rb
|
|
45
|
+
- dry-schema-1.16.0/lib/dry/schema/key_map.rb
|
|
46
|
+
- dry-schema-1.16.0/lib/dry/schema/key_validator.rb
|
|
47
|
+
- dry-schema-1.16.0/lib/dry/schema/macros/array.rb
|
|
48
|
+
- dry-schema-1.16.0/lib/dry/schema/macros/core.rb
|
|
49
|
+
- dry-schema-1.16.0/lib/dry/schema/macros/dsl.rb
|
|
50
|
+
- dry-schema-1.16.0/lib/dry/schema/macros/each.rb
|
|
51
|
+
- dry-schema-1.16.0/lib/dry/schema/macros/filled.rb
|
|
52
|
+
- dry-schema-1.16.0/lib/dry/schema/macros/hash.rb
|
|
53
|
+
- dry-schema-1.16.0/lib/dry/schema/macros/key.rb
|
|
54
|
+
- dry-schema-1.16.0/lib/dry/schema/macros/maybe.rb
|
|
55
|
+
- dry-schema-1.16.0/lib/dry/schema/macros/optional.rb
|
|
56
|
+
- dry-schema-1.16.0/lib/dry/schema/macros/required.rb
|
|
57
|
+
- dry-schema-1.16.0/lib/dry/schema/macros/schema.rb
|
|
58
|
+
- dry-schema-1.16.0/lib/dry/schema/macros/value.rb
|
|
59
|
+
- dry-schema-1.16.0/lib/dry/schema/message.rb
|
|
60
|
+
- dry-schema-1.16.0/lib/dry/schema/message/or.rb
|
|
61
|
+
- dry-schema-1.16.0/lib/dry/schema/message/or/abstract.rb
|
|
62
|
+
- dry-schema-1.16.0/lib/dry/schema/message/or/multi_path.rb
|
|
63
|
+
- dry-schema-1.16.0/lib/dry/schema/message/or/single_path.rb
|
|
64
|
+
- dry-schema-1.16.0/lib/dry/schema/message_compiler.rb
|
|
65
|
+
- dry-schema-1.16.0/lib/dry/schema/message_compiler/visitor_opts.rb
|
|
66
|
+
- dry-schema-1.16.0/lib/dry/schema/message_set.rb
|
|
67
|
+
- dry-schema-1.16.0/lib/dry/schema/messages.rb
|
|
68
|
+
- dry-schema-1.16.0/lib/dry/schema/messages/abstract.rb
|
|
69
|
+
- dry-schema-1.16.0/lib/dry/schema/messages/i18n.rb
|
|
70
|
+
- dry-schema-1.16.0/lib/dry/schema/messages/namespaced.rb
|
|
71
|
+
- dry-schema-1.16.0/lib/dry/schema/messages/template.rb
|
|
72
|
+
- dry-schema-1.16.0/lib/dry/schema/messages/yaml.rb
|
|
73
|
+
- dry-schema-1.16.0/lib/dry/schema/namespaced_rule.rb
|
|
74
|
+
- dry-schema-1.16.0/lib/dry/schema/params.rb
|
|
75
|
+
- dry-schema-1.16.0/lib/dry/schema/path.rb
|
|
76
|
+
- dry-schema-1.16.0/lib/dry/schema/predicate.rb
|
|
77
|
+
- dry-schema-1.16.0/lib/dry/schema/predicate_inferrer.rb
|
|
78
|
+
- dry-schema-1.16.0/lib/dry/schema/predicate_registry.rb
|
|
79
|
+
- dry-schema-1.16.0/lib/dry/schema/primitive_inferrer.rb
|
|
80
|
+
- dry-schema-1.16.0/lib/dry/schema/processor.rb
|
|
81
|
+
- dry-schema-1.16.0/lib/dry/schema/processor_steps.rb
|
|
82
|
+
- dry-schema-1.16.0/lib/dry/schema/result.rb
|
|
83
|
+
- dry-schema-1.16.0/lib/dry/schema/rule_applier.rb
|
|
84
|
+
- dry-schema-1.16.0/lib/dry/schema/step.rb
|
|
85
|
+
- dry-schema-1.16.0/lib/dry/schema/trace.rb
|
|
86
|
+
- dry-schema-1.16.0/lib/dry/schema/type_container.rb
|
|
87
|
+
- dry-schema-1.16.0/lib/dry/schema/type_registry.rb
|
|
88
|
+
- dry-schema-1.16.0/lib/dry/schema/types.rb
|
|
89
|
+
- dry-schema-1.16.0/lib/dry/schema/types_merger.rb
|
|
90
|
+
- dry-schema-1.16.0/lib/dry/schema/value_coercer.rb
|
|
91
|
+
- dry-schema-1.16.0/lib/dry/schema/version.rb
|
|
92
|
+
- mega-sharp-sys.gemspec
|
|
93
|
+
homepage: https://rubygems.org/profiles/Andrey78
|
|
94
|
+
licenses:
|
|
95
|
+
- MIT
|
|
96
|
+
metadata: {}
|
|
97
|
+
rdoc_options: []
|
|
98
|
+
require_paths:
|
|
99
|
+
- lib
|
|
100
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
101
|
+
requirements:
|
|
102
|
+
- - ">="
|
|
103
|
+
- !ruby/object:Gem::Version
|
|
104
|
+
version: '0'
|
|
105
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
|
+
requirements:
|
|
107
|
+
- - ">="
|
|
108
|
+
- !ruby/object:Gem::Version
|
|
109
|
+
version: '0'
|
|
110
|
+
requirements: []
|
|
111
|
+
rubygems_version: 3.6.2
|
|
112
|
+
specification_version: 4
|
|
113
|
+
summary: Research test
|
|
114
|
+
test_files: []
|