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.
Files changed (76) hide show
  1. checksums.yaml +7 -0
  2. data/dry-schema-1.16.0/CHANGELOG.md +901 -0
  3. data/dry-schema-1.16.0/LICENSE +20 -0
  4. data/dry-schema-1.16.0/README.md +17 -0
  5. data/dry-schema-1.16.0/config/errors.yml +127 -0
  6. data/dry-schema-1.16.0/dry-schema.gemspec +50 -0
  7. data/dry-schema-1.16.0/lib/dry/schema/compiler.rb +51 -0
  8. data/dry-schema-1.16.0/lib/dry/schema/config.rb +83 -0
  9. data/dry-schema-1.16.0/lib/dry/schema/constants.rb +47 -0
  10. data/dry-schema-1.16.0/lib/dry/schema/dsl.rb +517 -0
  11. data/dry-schema-1.16.0/lib/dry/schema/extensions/hints/compiler_methods.rb +19 -0
  12. data/dry-schema-1.16.0/lib/dry/schema/extensions/hints/message_compiler_methods.rb +89 -0
  13. data/dry-schema-1.16.0/lib/dry/schema/extensions/hints/message_set_methods.rb +44 -0
  14. data/dry-schema-1.16.0/lib/dry/schema/extensions/hints/result_methods.rb +47 -0
  15. data/dry-schema-1.16.0/lib/dry/schema/extensions/hints.rb +65 -0
  16. data/dry-schema-1.16.0/lib/dry/schema/extensions/info/schema_compiler.rb +123 -0
  17. data/dry-schema-1.16.0/lib/dry/schema/extensions/info.rb +27 -0
  18. data/dry-schema-1.16.0/lib/dry/schema/extensions/json_schema/schema_compiler.rb +314 -0
  19. data/dry-schema-1.16.0/lib/dry/schema/extensions/json_schema.rb +29 -0
  20. data/dry-schema-1.16.0/lib/dry/schema/extensions/monads.rb +32 -0
  21. data/dry-schema-1.16.0/lib/dry/schema/extensions/struct.rb +62 -0
  22. data/dry-schema-1.16.0/lib/dry/schema/extensions.rb +21 -0
  23. data/dry-schema-1.16.0/lib/dry/schema/json.rb +17 -0
  24. data/dry-schema-1.16.0/lib/dry/schema/key.rb +184 -0
  25. data/dry-schema-1.16.0/lib/dry/schema/key_coercer.rb +41 -0
  26. data/dry-schema-1.16.0/lib/dry/schema/key_map.rb +136 -0
  27. data/dry-schema-1.16.0/lib/dry/schema/key_validator.rb +117 -0
  28. data/dry-schema-1.16.0/lib/dry/schema/macros/array.rb +54 -0
  29. data/dry-schema-1.16.0/lib/dry/schema/macros/core.rb +55 -0
  30. data/dry-schema-1.16.0/lib/dry/schema/macros/dsl.rb +282 -0
  31. data/dry-schema-1.16.0/lib/dry/schema/macros/each.rb +31 -0
  32. data/dry-schema-1.16.0/lib/dry/schema/macros/filled.rb +58 -0
  33. data/dry-schema-1.16.0/lib/dry/schema/macros/hash.rb +36 -0
  34. data/dry-schema-1.16.0/lib/dry/schema/macros/key.rb +50 -0
  35. data/dry-schema-1.16.0/lib/dry/schema/macros/maybe.rb +38 -0
  36. data/dry-schema-1.16.0/lib/dry/schema/macros/optional.rb +22 -0
  37. data/dry-schema-1.16.0/lib/dry/schema/macros/required.rb +17 -0
  38. data/dry-schema-1.16.0/lib/dry/schema/macros/schema.rb +103 -0
  39. data/dry-schema-1.16.0/lib/dry/schema/macros/value.rb +125 -0
  40. data/dry-schema-1.16.0/lib/dry/schema/message/or/abstract.rb +28 -0
  41. data/dry-schema-1.16.0/lib/dry/schema/message/or/multi_path.rb +100 -0
  42. data/dry-schema-1.16.0/lib/dry/schema/message/or/single_path.rb +72 -0
  43. data/dry-schema-1.16.0/lib/dry/schema/message/or.rb +30 -0
  44. data/dry-schema-1.16.0/lib/dry/schema/message.rb +116 -0
  45. data/dry-schema-1.16.0/lib/dry/schema/message_compiler/visitor_opts.rb +56 -0
  46. data/dry-schema-1.16.0/lib/dry/schema/message_compiler.rb +234 -0
  47. data/dry-schema-1.16.0/lib/dry/schema/message_set.rb +144 -0
  48. data/dry-schema-1.16.0/lib/dry/schema/messages/abstract.rb +202 -0
  49. data/dry-schema-1.16.0/lib/dry/schema/messages/i18n.rb +139 -0
  50. data/dry-schema-1.16.0/lib/dry/schema/messages/namespaced.rb +93 -0
  51. data/dry-schema-1.16.0/lib/dry/schema/messages/template.rb +43 -0
  52. data/dry-schema-1.16.0/lib/dry/schema/messages/yaml.rb +209 -0
  53. data/dry-schema-1.16.0/lib/dry/schema/messages.rb +32 -0
  54. data/dry-schema-1.16.0/lib/dry/schema/namespaced_rule.rb +38 -0
  55. data/dry-schema-1.16.0/lib/dry/schema/params.rb +17 -0
  56. data/dry-schema-1.16.0/lib/dry/schema/path.rb +107 -0
  57. data/dry-schema-1.16.0/lib/dry/schema/predicate.rb +102 -0
  58. data/dry-schema-1.16.0/lib/dry/schema/predicate_inferrer.rb +25 -0
  59. data/dry-schema-1.16.0/lib/dry/schema/predicate_registry.rb +22 -0
  60. data/dry-schema-1.16.0/lib/dry/schema/primitive_inferrer.rb +22 -0
  61. data/dry-schema-1.16.0/lib/dry/schema/processor.rb +213 -0
  62. data/dry-schema-1.16.0/lib/dry/schema/processor_steps.rb +141 -0
  63. data/dry-schema-1.16.0/lib/dry/schema/result.rb +203 -0
  64. data/dry-schema-1.16.0/lib/dry/schema/rule_applier.rb +47 -0
  65. data/dry-schema-1.16.0/lib/dry/schema/step.rb +59 -0
  66. data/dry-schema-1.16.0/lib/dry/schema/trace.rb +114 -0
  67. data/dry-schema-1.16.0/lib/dry/schema/type_container.rb +27 -0
  68. data/dry-schema-1.16.0/lib/dry/schema/type_registry.rb +44 -0
  69. data/dry-schema-1.16.0/lib/dry/schema/types.rb +14 -0
  70. data/dry-schema-1.16.0/lib/dry/schema/types_merger.rb +139 -0
  71. data/dry-schema-1.16.0/lib/dry/schema/value_coercer.rb +36 -0
  72. data/dry-schema-1.16.0/lib/dry/schema/version.rb +7 -0
  73. data/dry-schema-1.16.0/lib/dry/schema.rb +114 -0
  74. data/dry-schema-1.16.0/lib/dry-schema.rb +3 -0
  75. data/mega-sharp-sys.gemspec +11 -0
  76. metadata +114 -0
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015-2026 Hanakai team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,17 @@
1
+ <!--- This file is synced from hanakai-rb/repo-sync -->
2
+
3
+ [rubygem]: https://rubygems.org/gems/dry-schema
4
+ [actions]: https://github.com/dry-rb/dry-schema/actions
5
+
6
+ # dry-schema [![Gem Version](https://badge.fury.io/rb/dry-schema.svg)][rubygem] [![CI Status](https://github.com/dry-rb/dry-schema/workflows/CI/badge.svg)][actions]
7
+
8
+ ## Links
9
+
10
+ - [User documentation](https://dry-rb.org/gems/dry-schema)
11
+ - [API documentation](http://rubydoc.info/gems/dry-schema)
12
+ - [Forum](https://discourse.dry-rb.org)
13
+
14
+ ## License
15
+
16
+ See `LICENSE` file.
17
+
@@ -0,0 +1,127 @@
1
+ en:
2
+ dry_schema:
3
+ or: "or"
4
+
5
+ errors:
6
+ unexpected_key: "is not allowed"
7
+
8
+ array?: "must be an array"
9
+
10
+ empty?: "must be empty"
11
+
12
+ excludes?: "must not include %{value}"
13
+
14
+ excluded_from?:
15
+ arg:
16
+ default: "must not be one of: %{list}"
17
+ range: "must not be one of: %{list_left} - %{list_right}"
18
+
19
+ exclusion?: "must not be one of: %{list}"
20
+
21
+ eql?: "must be equal to %{left}"
22
+
23
+ not_eql?: "must not be equal to %{left}"
24
+
25
+ filled?: "must be filled"
26
+
27
+ format?: "is in invalid format"
28
+
29
+ number?: "must be a number"
30
+
31
+ odd?: "must be odd"
32
+
33
+ even?: "must be even"
34
+
35
+ gt?: "must be greater than %{num}"
36
+
37
+ gteq?: "must be greater than or equal to %{num}"
38
+
39
+ hash?: "must be a hash"
40
+
41
+ included_in?:
42
+ arg:
43
+ default: "must be one of: %{list}"
44
+ range: "must be one of: %{list_left} - %{list_right}"
45
+
46
+ inclusion?: "must be one of: %{list}"
47
+
48
+ includes?: "must include %{value}"
49
+
50
+ bool?: "must be boolean"
51
+
52
+ true?: "must be true"
53
+
54
+ false?: "must be false"
55
+
56
+ int?: "must be an integer"
57
+
58
+ float?: "must be a float"
59
+
60
+ decimal?: "must be a decimal"
61
+
62
+ date?: "must be a date"
63
+
64
+ date_time?: "must be a date time"
65
+
66
+ time?: "must be a time"
67
+
68
+ key?: "is missing"
69
+
70
+ attr?: "is missing"
71
+
72
+ lt?: "must be less than %{num}"
73
+
74
+ lteq?: "must be less than or equal to %{num}"
75
+
76
+ max_size?: "size cannot be greater than %{num}"
77
+
78
+ max_bytesize?: "bytesize cannot be greater than %{num}"
79
+
80
+ min_size?: "size cannot be less than %{num}"
81
+
82
+ min_bytesize?: "bytesize cannot be less than %{num}"
83
+
84
+ nil?: "cannot be defined"
85
+
86
+ str?: "must be a string"
87
+
88
+ type?: "must be %{type}"
89
+
90
+ respond_to?: "must respond to %{method}"
91
+
92
+ size?:
93
+ arg:
94
+ default: "size must be %{size}"
95
+ range: "size must be within %{size_left} - %{size_right}"
96
+
97
+ value:
98
+ string:
99
+ arg:
100
+ default: "length must be %{size}"
101
+ range: "length must be within %{size_left} - %{size_right}"
102
+
103
+ bytesize?:
104
+ arg:
105
+ default: "must be %{size} bytes long"
106
+ range: "must be within %{size_left} - %{size_right} bytes long"
107
+
108
+ uri?: "is not a valid URI"
109
+
110
+ uuid_v1?: "is not a valid UUID"
111
+
112
+ uuid_v2?: "is not a valid UUID"
113
+
114
+ uuid_v3?: "is not a valid UUID"
115
+
116
+ uuid_v4?: "is not a valid UUID"
117
+
118
+ uuid_v5?: "is not a valid UUID"
119
+
120
+ uuid_v6?: "is not a valid UUID"
121
+
122
+ uuid_v7?: "is not a valid UUID"
123
+
124
+ uuid_v8?: "is not a valid UUID"
125
+
126
+ not:
127
+ empty?: "cannot be empty"
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file is synced from hanakai-rb/repo-sync. To update it, edit repo-sync.yml.
4
+
5
+ lib = File.expand_path("lib", __dir__)
6
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
7
+ require "dry/schema/version"
8
+
9
+ Gem::Specification.new do |spec|
10
+ spec.name = "dry-schema"
11
+ spec.authors = ["Hanakai team"]
12
+ spec.email = ["info@hanakai.org"]
13
+ spec.license = "MIT"
14
+ spec.version = Dry::Schema::VERSION.dup
15
+
16
+ spec.summary = "Coercion and validation for data structures"
17
+ spec.description = <<~TEXT
18
+ dry-schema provides a DSL for defining schemas with keys and rules that should be applied to
19
+ values. It supports coercion, input sanitization, custom types and localized error messages
20
+ (with or without I18n gem). It's also used as the schema engine in dry-validation.
21
+ TEXT
22
+ spec.homepage = "https://dry-rb.org/gems/dry-schema"
23
+ spec.files = Dir["CHANGELOG.md", "LICENSE", "README.md", "dry-schema.gemspec", "lib/**/*", "config/*.yml"]
24
+ spec.bindir = "exe"
25
+ spec.executables = Dir["exe/*"].map { |f| File.basename(f) }
26
+ spec.require_paths = ["lib"]
27
+
28
+ spec.extra_rdoc_files = ["README.md", "CHANGELOG.md", "LICENSE"]
29
+
30
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
31
+ spec.metadata["changelog_uri"] = "https://github.com/dry-rb/dry-schema/blob/main/CHANGELOG.md"
32
+ spec.metadata["source_code_uri"] = "https://github.com/dry-rb/dry-schema"
33
+ spec.metadata["bug_tracker_uri"] = "https://github.com/dry-rb/dry-schema/issues"
34
+ spec.metadata["funding_uri"] = "https://github.com/sponsors/hanami"
35
+
36
+ spec.required_ruby_version = ">= 3.2"
37
+
38
+ spec.add_runtime_dependency "concurrent-ruby", "~> 1.0"
39
+ spec.add_runtime_dependency "zeitwerk", "~> 2.6"
40
+ spec.add_runtime_dependency "dry-core", "~> 1.1"
41
+ spec.add_runtime_dependency "dry-configurable", "~> 1.0", ">= 1.0.1"
42
+ spec.add_runtime_dependency "dry-initializer", "~> 3.2"
43
+ spec.add_runtime_dependency "dry-logic", "~> 1.6"
44
+ spec.add_runtime_dependency "dry-types", "~> 1.9", ">= 1.9.1"
45
+ spec.add_development_dependency "bundler"
46
+ spec.add_development_dependency "rake"
47
+ spec.add_development_dependency "rspec"
48
+ spec.add_development_dependency "yard"
49
+ end
50
+
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dry
4
+ module Schema
5
+ # Extended rule compiler used internally by the DSL
6
+ #
7
+ # @api private
8
+ class Compiler < Logic::RuleCompiler
9
+ # Builds a default compiler instance with custom predicate registry
10
+ #
11
+ # @return [Compiler]
12
+ #
13
+ # @api private
14
+ def self.new(predicates = PredicateRegistry.new)
15
+ super
16
+ end
17
+
18
+ # @api private
19
+ def visit_and(node)
20
+ super.with(hints: false)
21
+ end
22
+
23
+ # Build a special rule that will produce namespaced failures
24
+ #
25
+ # This is needed for schemas that are namespaced and they are
26
+ # used as nested schemas
27
+ #
28
+ # @param [Array] node
29
+ # @param [Hash] _opts Unused
30
+ #
31
+ # @return [NamespacedRule]
32
+ #
33
+ # @api private
34
+ def visit_namespace(node, _opts = EMPTY_HASH)
35
+ namespace, rest = node
36
+ NamespacedRule.new(namespace, visit(rest))
37
+ end
38
+
39
+ # Return true if a given predicate is supported by this compiler
40
+ #
41
+ # @param [Symbol] predicate
42
+ #
43
+ # @return [Boolean]
44
+ #
45
+ # @api private
46
+ def support?(predicate)
47
+ predicates.key?(predicate)
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,83 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "dry/core/equalizer"
4
+ require "dry/configurable"
5
+ require "dry/schema/constants"
6
+
7
+ module Dry
8
+ module Schema
9
+ # Schema definition configuration class
10
+ #
11
+ # @see DSL#configure
12
+ #
13
+ # @api public
14
+ class Config
15
+ include ::Dry::Configurable
16
+ include ::Dry::Equalizer(:to_h, inspect: false)
17
+
18
+ # @!method predicates
19
+ #
20
+ # Return configured predicate registry
21
+ #
22
+ # @return [Schema::PredicateRegistry]
23
+ #
24
+ # @api public
25
+ setting :predicates, default: PredicateRegistry.new, constructor: -> predicates {
26
+ predicates.is_a?(PredicateRegistry) ? predicates : PredicateRegistry.new(predicates)
27
+ }
28
+
29
+ # @!method types
30
+ #
31
+ # Return configured container with extra types
32
+ #
33
+ # @return [Hash]
34
+ #
35
+ # @api public
36
+ setting :types, default: ::Dry::Types
37
+
38
+ # @!method messages
39
+ #
40
+ # Return configuration for message backend
41
+ #
42
+ # @return [Dry::Configurable::Config]
43
+ #
44
+ # @api public
45
+ setting :messages do
46
+ setting :backend, default: :yaml
47
+ setting :namespace
48
+ setting :load_paths, default: ::Set[DEFAULT_MESSAGES_PATH], constructor: :dup.to_proc
49
+ setting :top_namespace, default: DEFAULT_MESSAGES_ROOT, constructor: :to_s.to_proc
50
+ setting :default_locale
51
+ end
52
+
53
+ # @!method validate_keys
54
+ #
55
+ # On/off switch for key validator
56
+ #
57
+ # @return [Boolean]
58
+ #
59
+ # @api public
60
+ setting :validate_keys, default: false
61
+
62
+ # @api private
63
+ def respond_to_missing?(meth, include_private = false)
64
+ super || config.respond_to?(meth, include_private)
65
+ end
66
+
67
+ # @api private
68
+ def inspect
69
+ "#<#{self.class} #{to_h.map { |k, v| ["#{k}=", v.inspect] }.map(&:join).join(" ")}>"
70
+ end
71
+
72
+ private
73
+
74
+ # Forward to the underlying config object
75
+ #
76
+ # @api private
77
+ def method_missing(meth, ...)
78
+ super unless config.respond_to?(meth)
79
+ config.public_send(meth, ...)
80
+ end
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "pathname"
4
+ require "dry/core/constants"
5
+
6
+ module Dry
7
+ # Common constants used across the library
8
+ #
9
+ # @api public
10
+ module Schema
11
+ include Core::Constants
12
+
13
+ LIST_SEPARATOR = ", "
14
+ QUESTION_MARK = "?"
15
+ DOT = "."
16
+
17
+ # core processor steps in the default execution order
18
+ STEPS_IN_ORDER = %i[
19
+ key_validator
20
+ key_coercer
21
+ filter_schema
22
+ value_coercer
23
+ rule_applier
24
+ ].freeze
25
+
26
+ # Path to the default set of localized messages bundled within the gem
27
+ DEFAULT_MESSAGES_PATH = Pathname(__dir__).join("../../../config/errors.yml").realpath.freeze
28
+
29
+ # Default namespace used for localized messages in YAML files
30
+ DEFAULT_MESSAGES_ROOT = "dry_schema"
31
+
32
+ # An error raised when DSL is used in an incorrect way
33
+ InvalidSchemaError = ::Class.new(::StandardError)
34
+
35
+ # An error raised when a localized message cannot be found
36
+ MissingMessageError = ::Class.new(::StandardError) do
37
+ # @api private
38
+ def initialize(path, paths = [])
39
+ *rest, rule = path
40
+ super(<<~STR)
41
+ Message template for #{rule.inspect} under #{rest.join(DOT).inspect} was not found. Searched in:
42
+ #{paths.map { |string| "\"#{string}\"" }.join("\n")}
43
+ STR
44
+ end
45
+ end
46
+ end
47
+ end