smart_schema 0.12.0 → 0.12.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 (82) hide show
  1. checksums.yaml +4 -4
  2. metadata +3 -83
  3. data/.gitignore +0 -12
  4. data/.rspec +0 -3
  5. data/.rubocop.yml +0 -20
  6. data/CHANGELOG.md +0 -79
  7. data/CODE_OF_CONDUCT.md +0 -74
  8. data/Gemfile +0 -5
  9. data/Gemfile.lock +0 -266
  10. data/LICENSE.txt +0 -21
  11. data/README.md +0 -305
  12. data/Rakefile +0 -21
  13. data/bin/console +0 -8
  14. data/bin/setup +0 -8
  15. data/lib/smart_core/schema/checker/reconciler/constructor.rb +0 -60
  16. data/lib/smart_core/schema/checker/reconciler/matcher/options.rb +0 -33
  17. data/lib/smart_core/schema/checker/reconciler/matcher/result.rb +0 -87
  18. data/lib/smart_core/schema/checker/reconciler/matcher/result_finalizer.rb +0 -186
  19. data/lib/smart_core/schema/checker/reconciler/matcher.rb +0 -62
  20. data/lib/smart_core/schema/checker/reconciler.rb +0 -106
  21. data/lib/smart_core/schema/checker/rules/base.rb +0 -110
  22. data/lib/smart_core/schema/checker/rules/extra_keys/failure.rb +0 -24
  23. data/lib/smart_core/schema/checker/rules/extra_keys/result.rb +0 -37
  24. data/lib/smart_core/schema/checker/rules/extra_keys/success.rb +0 -30
  25. data/lib/smart_core/schema/checker/rules/extra_keys.rb +0 -31
  26. data/lib/smart_core/schema/checker/rules/optional.rb +0 -27
  27. data/lib/smart_core/schema/checker/rules/options/empty.rb +0 -43
  28. data/lib/smart_core/schema/checker/rules/options/filled.rb +0 -49
  29. data/lib/smart_core/schema/checker/rules/options/type.rb +0 -88
  30. data/lib/smart_core/schema/checker/rules/options.rb +0 -60
  31. data/lib/smart_core/schema/checker/rules/required.rb +0 -27
  32. data/lib/smart_core/schema/checker/rules/requirement/optional.rb +0 -36
  33. data/lib/smart_core/schema/checker/rules/requirement/required.rb +0 -36
  34. data/lib/smart_core/schema/checker/rules/requirement/result.rb +0 -95
  35. data/lib/smart_core/schema/checker/rules/requirement.rb +0 -9
  36. data/lib/smart_core/schema/checker/rules/result/base.rb +0 -44
  37. data/lib/smart_core/schema/checker/rules/result/failure.rb +0 -41
  38. data/lib/smart_core/schema/checker/rules/result/success.rb +0 -15
  39. data/lib/smart_core/schema/checker/rules/result.rb +0 -9
  40. data/lib/smart_core/schema/checker/rules/type_aliases.rb +0 -57
  41. data/lib/smart_core/schema/checker/rules/verifier/result.rb +0 -75
  42. data/lib/smart_core/schema/checker/rules/verifier.rb +0 -74
  43. data/lib/smart_core/schema/checker/rules.rb +0 -89
  44. data/lib/smart_core/schema/checker/verifiable_hash.rb +0 -65
  45. data/lib/smart_core/schema/checker.rb +0 -106
  46. data/lib/smart_core/schema/configuration.rb +0 -33
  47. data/lib/smart_core/schema/dsl.rb +0 -81
  48. data/lib/smart_core/schema/errors.rb +0 -65
  49. data/lib/smart_core/schema/key_control.rb +0 -39
  50. data/lib/smart_core/schema/plugins/abstract.rb +0 -55
  51. data/lib/smart_core/schema/plugins/access_mixin.rb +0 -47
  52. data/lib/smart_core/schema/plugins/dry_types/dry_types/abstract_factory.rb +0 -91
  53. data/lib/smart_core/schema/plugins/dry_types/dry_types/operation/base.rb +0 -9
  54. data/lib/smart_core/schema/plugins/dry_types/dry_types/operation/cast.rb +0 -21
  55. data/lib/smart_core/schema/plugins/dry_types/dry_types/operation/valid.rb +0 -16
  56. data/lib/smart_core/schema/plugins/dry_types/dry_types/operation/validate.rb +0 -19
  57. data/lib/smart_core/schema/plugins/dry_types/dry_types/operation.rb +0 -12
  58. data/lib/smart_core/schema/plugins/dry_types/dry_types.rb +0 -10
  59. data/lib/smart_core/schema/plugins/dry_types/errors.rb +0 -13
  60. data/lib/smart_core/schema/plugins/dry_types.rb +0 -27
  61. data/lib/smart_core/schema/plugins/registry.rb +0 -158
  62. data/lib/smart_core/schema/plugins/registry_interface.rb +0 -63
  63. data/lib/smart_core/schema/plugins.rb +0 -17
  64. data/lib/smart_core/schema/result.rb +0 -62
  65. data/lib/smart_core/schema/type_system/interop/abstract_factory.rb +0 -80
  66. data/lib/smart_core/schema/type_system/interop/aliasing/alias_list.rb +0 -131
  67. data/lib/smart_core/schema/type_system/interop/aliasing.rb +0 -72
  68. data/lib/smart_core/schema/type_system/interop/operation.rb +0 -30
  69. data/lib/smart_core/schema/type_system/interop.rb +0 -120
  70. data/lib/smart_core/schema/type_system/registry.rb +0 -162
  71. data/lib/smart_core/schema/type_system/registry_interface.rb +0 -87
  72. data/lib/smart_core/schema/type_system/smart_types/abstract_factory.rb +0 -91
  73. data/lib/smart_core/schema/type_system/smart_types/operation/base.rb +0 -8
  74. data/lib/smart_core/schema/type_system/smart_types/operation/cast.rb +0 -16
  75. data/lib/smart_core/schema/type_system/smart_types/operation/valid.rb +0 -16
  76. data/lib/smart_core/schema/type_system/smart_types/operation/validate.rb +0 -16
  77. data/lib/smart_core/schema/type_system/smart_types/operation.rb +0 -13
  78. data/lib/smart_core/schema/type_system/smart_types.rb +0 -48
  79. data/lib/smart_core/schema/type_system.rb +0 -16
  80. data/lib/smart_core/schema/version.rb +0 -14
  81. data/lib/smart_core/schema.rb +0 -67
  82. data/smart_schema.gemspec +0 -46
@@ -1,16 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module SmartCore::Schema::TypeSystem::SmartTypes::Operation
4
- # @api private
5
- # @since 0.12.0
6
- class Valid < Base
7
- # @param value [Any]
8
- # @return [Boolean]
9
- #
10
- # @api private
11
- # @since 0.12.0
12
- def call(value)
13
- type.valid?(value)
14
- end
15
- end
16
- end
@@ -1,16 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module SmartCore::Schema::TypeSystem::SmartTypes::Operation
4
- # @api private
5
- # @since 0.12.0
6
- class Validate < Base
7
- # @param value [Any]
8
- # @return [void]
9
- #
10
- # @api private
11
- # @since 0.12.0
12
- def call(value)
13
- type.validate!(value)
14
- end
15
- end
16
- end
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module SmartCore::Schema::TypeSystem
4
- # @abstract
5
- # @api private
6
- # @since 0.12.0
7
- module SmartTypes::Operation
8
- require_relative 'operation/base'
9
- require_relative 'operation/valid'
10
- require_relative 'operation/validate'
11
- require_relative 'operation/cast'
12
- end
13
- end
@@ -1,48 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # @api private
4
- # @since 0.12.0
5
- class SmartCore::Schema::TypeSystem::SmartTypes < SmartCore::Schema::TypeSystem::Interop
6
- require_relative 'smart_types/abstract_factory'
7
- require_relative 'smart_types/operation'
8
-
9
- type_alias('value.any', SmartCore::Types::Value::Any)
10
- type_alias('value.nil', SmartCore::Types::Value::Nil)
11
- type_alias('value.string', SmartCore::Types::Value::String)
12
- type_alias('value.symbol', SmartCore::Types::Value::Symbol)
13
- type_alias('value.text', SmartCore::Types::Value::Text)
14
- type_alias('value.integer', SmartCore::Types::Value::Integer)
15
- type_alias('value.float', SmartCore::Types::Value::Float)
16
- type_alias('value.numeric', SmartCore::Types::Value::Numeric)
17
- type_alias('value.big_decimal', SmartCore::Types::Value::BigDecimal)
18
- type_alias('value.boolean', SmartCore::Types::Value::Boolean)
19
- type_alias('value.array', SmartCore::Types::Value::Array)
20
- type_alias('value.hash', SmartCore::Types::Value::Hash)
21
- type_alias('value.proc', SmartCore::Types::Value::Proc)
22
- type_alias('value.class', SmartCore::Types::Value::Class)
23
- type_alias('value.module', SmartCore::Types::Value::Module)
24
- type_alias('value.time', SmartCore::Types::Value::Time)
25
- type_alias('value.date_time', SmartCore::Types::Value::DateTime)
26
- type_alias('value.date', SmartCore::Types::Value::Date)
27
- type_alias('value.time_based', SmartCore::Types::Value::TimeBased)
28
-
29
- type_alias(:any, SmartCore::Types::Value::Any)
30
- type_alias(:nil, SmartCore::Types::Value::Nil)
31
- type_alias(:string, SmartCore::Types::Value::String)
32
- type_alias(:symbol, SmartCore::Types::Value::Symbol)
33
- type_alias(:text, SmartCore::Types::Value::Text)
34
- type_alias(:integer, SmartCore::Types::Value::Integer)
35
- type_alias(:float, SmartCore::Types::Value::Float)
36
- type_alias(:numeric, SmartCore::Types::Value::Numeric)
37
- type_alias(:big_decimal, SmartCore::Types::Value::BigDecimal)
38
- type_alias(:boolean, SmartCore::Types::Value::Boolean)
39
- type_alias(:array, SmartCore::Types::Value::Array)
40
- type_alias(:hash, SmartCore::Types::Value::Hash)
41
- type_alias(:proc, SmartCore::Types::Value::Proc)
42
- type_alias(:class, SmartCore::Types::Value::Class)
43
- type_alias(:module, SmartCore::Types::Value::Module)
44
- type_alias(:time, SmartCore::Types::Value::Time)
45
- type_alias(:date_time, SmartCore::Types::Value::DateTime)
46
- type_alias(:date, SmartCore::Types::Value::Date)
47
- type_alias(:time_based, SmartCore::Types::Value::TimeBased)
48
- end
@@ -1,16 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # @api pulic
4
- # @since 0.12.0
5
- module SmartCore::Schema::TypeSystem
6
- require_relative 'type_system/interop'
7
- require_relative 'type_system/registry'
8
- require_relative 'type_system/smart_types'
9
- require_relative 'type_system/registry_interface'
10
-
11
- # @since 0.12.0
12
- extend SmartCore::Schema::TypeSystem::RegistryInterface
13
-
14
- # @since 0.12.0
15
- register(:smart_types, SmartCore::Schema::TypeSystem::SmartTypes)
16
- end
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module SmartCore
4
- # rubocop:disable Style/StaticClass
5
- class Schema
6
- # @return [String]
7
- #
8
- # @api public
9
- # @since 0.1.0
10
- # @version 0.12.0
11
- VERSION = '0.12.0'
12
- end
13
- # rubocop:enable Style/StaticClass
14
- end
@@ -1,67 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'smart_core'
4
- require 'smart_core/types'
5
- require 'forwardable'
6
-
7
- # @api pulic
8
- # @since 0.1.0
9
- module SmartCore
10
- # @api public
11
- # @since 0.1.0
12
- class Schema
13
- require_relative 'schema/version'
14
- require_relative 'schema/errors'
15
- require_relative 'schema/plugins'
16
- require_relative 'schema/type_system'
17
- require_relative 'schema/configuration'
18
- require_relative 'schema/key_control'
19
- require_relative 'schema/result'
20
- require_relative 'schema/checker'
21
- require_relative 'schema/dsl'
22
-
23
- # @since 0.1.0
24
- include SmartCore::Schema::DSL
25
-
26
- # @sicnce 0.12.0
27
- extend SmartCore::Schema::Plugins::AccessMixin
28
-
29
- class << self
30
- # NOTE/TODO: will be totally reworked with dynamic schema-instance-configurated type-system
31
- #
32
- # @api public
33
- # @since 0.12.0
34
- def type_system
35
- SmartCore::Schema::TypeSystem.resolve(SmartCore::Schema::Configuration[:type_system])
36
- end
37
- end
38
-
39
- # @param verifiable_hash [Hash<String|Symbol,Any>]
40
- # @return [Boolean]
41
- #
42
- # @api public
43
- # @since 0.1.0
44
- def valid?(verifiable_hash)
45
- validate(verifiable_hash).success?
46
- end
47
-
48
- # @param verifiable_hash [Hash<String|Symbol,Any>]
49
- # @return [SmartCore::Schema::Result]
50
- #
51
- # @api public
52
- # @since 0.1.0
53
- def validate(verifiable_hash)
54
- schema_checker.check!(verifiable_hash)
55
- end
56
-
57
- private
58
-
59
- # @return [SmartCore::Schema::Checker]
60
- #
61
- # @api private
62
- # @since 0.1.0
63
- def schema_checker
64
- self.class.__schema_checker__
65
- end
66
- end
67
- end
data/smart_schema.gemspec DELETED
@@ -1,46 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'lib/smart_core/schema/version'
4
-
5
- Gem::Specification.new do |spec|
6
- spec.required_ruby_version = Gem::Requirement.new('>= 3.3')
7
-
8
- spec.name = 'smart_schema'
9
- spec.version = SmartCore::Schema::VERSION
10
- spec.authors = ['Rustam Ibragimov']
11
- spec.email = ['iamdaiver@gmail.com']
12
-
13
- spec.summary = 'SmartCore::Schema is a schema validator for Hash-like data structures'
14
- spec.description = 'SmartCore::Schema is a schema validator for Hash-like data structures'
15
- spec.homepage = 'https://github.com/smart-rb/smart_schema'
16
- spec.license = 'MIT'
17
-
18
- spec.metadata['homepage_uri'] =
19
- spec.homepage
20
- spec.metadata['source_code_uri'] =
21
- 'https://github.com/smart-rb/smart_schema'
22
- spec.metadata['changelog_uri'] =
23
- 'https://github.com/smart-rb/smart_schema/blob/master/CHANGELOG.md'
24
-
25
- spec.files = Dir.chdir(File.expand_path(__dir__)) do
26
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
27
- end
28
-
29
- spec.bindir = 'exe'
30
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
- spec.require_paths = ['lib']
32
-
33
- spec.add_dependency 'smart_engine', '~> 0.17'
34
- spec.add_dependency 'smart_types', '~> 0.8'
35
- spec.add_dependency 'qonfig', '~> 0.30'
36
-
37
- spec.add_development_dependency 'dry-types', '~> 1.9'
38
-
39
- spec.add_development_dependency 'pry', '~> 0.16'
40
- spec.add_development_dependency 'pry-doc', '~> 1.7'
41
- spec.add_development_dependency 'bundler' # rubocop:disable Gemspec/DependencyVersion
42
- spec.add_development_dependency 'rake', '~> 13.3'
43
- spec.add_development_dependency 'rspec', '~> 3.13'
44
- spec.add_development_dependency 'armitage-rubocop', '~> 1.81'
45
- spec.add_development_dependency 'simplecov', '~> 0.22'
46
- end