rbdantic 0.1.0

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 (40) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/.rubocop.yml +245 -0
  4. data/.ruby-version +1 -0
  5. data/CHANGELOG.md +5 -0
  6. data/LICENSE.txt +21 -0
  7. data/README.md +852 -0
  8. data/README_CN.md +852 -0
  9. data/Rakefile +12 -0
  10. data/lib/rbdantic/base/access.rb +105 -0
  11. data/lib/rbdantic/base/dsl.rb +79 -0
  12. data/lib/rbdantic/base/validation.rb +152 -0
  13. data/lib/rbdantic/base.rb +30 -0
  14. data/lib/rbdantic/config.rb +60 -0
  15. data/lib/rbdantic/error_detail.rb +54 -0
  16. data/lib/rbdantic/field.rb +188 -0
  17. data/lib/rbdantic/json_schema/defs_registry.rb +79 -0
  18. data/lib/rbdantic/json_schema/generator.rb +148 -0
  19. data/lib/rbdantic/json_schema/types.rb +98 -0
  20. data/lib/rbdantic/serialization/dumper.rb +133 -0
  21. data/lib/rbdantic/serialization/json_serializer.rb +60 -0
  22. data/lib/rbdantic/validators/field_validator.rb +83 -0
  23. data/lib/rbdantic/validators/model_validator.rb +59 -0
  24. data/lib/rbdantic/validators/types/array.rb +77 -0
  25. data/lib/rbdantic/validators/types/base.rb +78 -0
  26. data/lib/rbdantic/validators/types/boolean.rb +37 -0
  27. data/lib/rbdantic/validators/types/float.rb +32 -0
  28. data/lib/rbdantic/validators/types/hash.rb +54 -0
  29. data/lib/rbdantic/validators/types/integer.rb +28 -0
  30. data/lib/rbdantic/validators/types/model.rb +75 -0
  31. data/lib/rbdantic/validators/types/number.rb +63 -0
  32. data/lib/rbdantic/validators/types/string.rb +70 -0
  33. data/lib/rbdantic/validators/types/symbol.rb +30 -0
  34. data/lib/rbdantic/validators/types/time.rb +33 -0
  35. data/lib/rbdantic/validators/types.rb +63 -0
  36. data/lib/rbdantic/validators/validator_context.rb +43 -0
  37. data/lib/rbdantic/version.rb +5 -0
  38. data/lib/rbdantic.rb +8 -0
  39. data/sig/rbdantic.rbs +4 -0
  40. metadata +84 -0
data/lib/rbdantic.rb ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "rbdantic/version"
4
+ require_relative "rbdantic/base"
5
+
6
+ module Rbdantic
7
+ # Root module for Rbdantic
8
+ end
data/sig/rbdantic.rbs ADDED
@@ -0,0 +1,4 @@
1
+ module Rbdantic
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,84 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rbdantic
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - cp5670681
8
+ bindir: exe
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies: []
12
+ description: Rbdantic provides BaseModel-like data classes with field validation,
13
+ type coercion, custom validators, JSON Schema generation, and serialization. Inspired
14
+ by Python's Pydantic.
15
+ email:
16
+ - cp5670681@163.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - ".rspec"
22
+ - ".rubocop.yml"
23
+ - ".ruby-version"
24
+ - CHANGELOG.md
25
+ - LICENSE.txt
26
+ - README.md
27
+ - README_CN.md
28
+ - Rakefile
29
+ - lib/rbdantic.rb
30
+ - lib/rbdantic/base.rb
31
+ - lib/rbdantic/base/access.rb
32
+ - lib/rbdantic/base/dsl.rb
33
+ - lib/rbdantic/base/validation.rb
34
+ - lib/rbdantic/config.rb
35
+ - lib/rbdantic/error_detail.rb
36
+ - lib/rbdantic/field.rb
37
+ - lib/rbdantic/json_schema/defs_registry.rb
38
+ - lib/rbdantic/json_schema/generator.rb
39
+ - lib/rbdantic/json_schema/types.rb
40
+ - lib/rbdantic/serialization/dumper.rb
41
+ - lib/rbdantic/serialization/json_serializer.rb
42
+ - lib/rbdantic/validators/field_validator.rb
43
+ - lib/rbdantic/validators/model_validator.rb
44
+ - lib/rbdantic/validators/types.rb
45
+ - lib/rbdantic/validators/types/array.rb
46
+ - lib/rbdantic/validators/types/base.rb
47
+ - lib/rbdantic/validators/types/boolean.rb
48
+ - lib/rbdantic/validators/types/float.rb
49
+ - lib/rbdantic/validators/types/hash.rb
50
+ - lib/rbdantic/validators/types/integer.rb
51
+ - lib/rbdantic/validators/types/model.rb
52
+ - lib/rbdantic/validators/types/number.rb
53
+ - lib/rbdantic/validators/types/string.rb
54
+ - lib/rbdantic/validators/types/symbol.rb
55
+ - lib/rbdantic/validators/types/time.rb
56
+ - lib/rbdantic/validators/validator_context.rb
57
+ - lib/rbdantic/version.rb
58
+ - sig/rbdantic.rbs
59
+ homepage: https://github.com/cp5670681/rbdantic
60
+ licenses:
61
+ - MIT
62
+ metadata:
63
+ allowed_push_host: https://rubygems.org
64
+ homepage_uri: https://github.com/cp5670681/rbdantic
65
+ source_code_uri: https://github.com/cp5670681/rbdantic
66
+ changelog_uri: https://github.com/cp5670681/rbdantic/blob/main/CHANGELOG.md
67
+ rdoc_options: []
68
+ require_paths:
69
+ - lib
70
+ required_ruby_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: 2.7.0
75
+ required_rubygems_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ requirements: []
81
+ rubygems_version: 3.6.7
82
+ specification_version: 4
83
+ summary: Pydantic-inspired data validation and serialization for Ruby
84
+ test_files: []