domainic-type 0.1.0.alpha.3.2.0 → 0.1.0.alpha.3.4.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 (31) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +11 -0
  3. data/README.md +66 -10
  4. data/docs/USAGE.md +787 -0
  5. data/lib/domainic/type/accessors.rb +3 -2
  6. data/lib/domainic/type/behavior/date_time_behavior.rb +121 -37
  7. data/lib/domainic/type/behavior.rb +16 -0
  8. data/lib/domainic/type/config/registry.yml +24 -0
  9. data/lib/domainic/type/constraint/constraints/nor_constraint.rb +1 -1
  10. data/lib/domainic/type/constraint/constraints/predicate_constraint.rb +76 -0
  11. data/lib/domainic/type/definitions.rb +212 -0
  12. data/lib/domainic/type/types/core/complex_type.rb +122 -0
  13. data/lib/domainic/type/types/core/range_type.rb +47 -0
  14. data/lib/domainic/type/types/core/rational_type.rb +38 -0
  15. data/lib/domainic/type/types/core_extended/big_decimal_type.rb +34 -0
  16. data/lib/domainic/type/types/core_extended/set_type.rb +34 -0
  17. data/lib/domainic/type/types/datetime/date_time_string_type.rb +156 -0
  18. data/lib/domainic/type/types/datetime/timestamp_type.rb +50 -0
  19. data/sig/domainic/type/accessors.rbs +2 -2
  20. data/sig/domainic/type/behavior/date_time_behavior.rbs +35 -23
  21. data/sig/domainic/type/behavior.rbs +9 -0
  22. data/sig/domainic/type/constraint/constraints/predicate_constraint.rbs +56 -0
  23. data/sig/domainic/type/definitions.rbs +165 -0
  24. data/sig/domainic/type/types/core/complex_type.rbs +96 -0
  25. data/sig/domainic/type/types/core/range_type.rbs +41 -0
  26. data/sig/domainic/type/types/core/rational_type.rbs +32 -0
  27. data/sig/domainic/type/types/core_extended/big_decimal_type.rbs +27 -0
  28. data/sig/domainic/type/types/core_extended/set_type.rbs +27 -0
  29. data/sig/domainic/type/types/datetime/date_time_string_type.rbs +124 -0
  30. data/sig/domainic/type/types/datetime/timestamp_type.rbs +44 -0
  31. metadata +25 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 24abfbef9f478a43dce3382a737ceec2ea4310f69454d5d3e8903699f97454a0
4
- data.tar.gz: aaede220a86b78362f4dd2a8e51ffdb320ba7352a88b4980dec244e7452662fc
3
+ metadata.gz: e864e12054b6928f12f7465eace3657aaa736e264a1655e7838ec4f2e658ebed
4
+ data.tar.gz: ac7c71c1bd2c2f992bb6aca1306291838a4b7eabc77326130db553de8a9dc18f
5
5
  SHA512:
6
- metadata.gz: 22de008f6805303b6540c879a35a11366c41e49be7dc7ca76347436afaedf256e5b19d8de9242e0351ab0ba78bb6eebf6ad3a202c105b1523ba414836e3a5c64
7
- data.tar.gz: 1eb03da0104dcd61ca5149471ae71f774206f342e01d23e73e71917db7189610346d7432d6f9ef9c0ef5a3f92767ec048905adb2004578d99fc7be82faf6c2b6
6
+ metadata.gz: 6029d7d12cb562dd7f2688472f0da97bcb548c544f163cf5215736d82ee0927e6f2c4ff87cc0d1818eefe722d10ac0ee2dd4ebccabff45412793340928e63cb8
7
+ data.tar.gz: 7ba6d7e41e431f2dd401bffecd60701a9dfeab35eeea3bef9085e97941d1b8327ddfd7cbe5febc577a0e1b3cce49147f6b686b56f1f6251257836d58327d198d
data/.yardopts ADDED
@@ -0,0 +1,11 @@
1
+ --title Domainic::Type
2
+ --readme README.md
3
+ --no-private
4
+ --protected
5
+ --markup markdown
6
+ --markup-provider redcarpet
7
+ --embed-mixins
8
+ --tag rbs
9
+ --hide-tag rbs
10
+ --files CHANGELOG.md,LICENSE,docs/USAGE.md
11
+ 'lib/**/*.rb'
data/README.md CHANGED
@@ -2,30 +2,86 @@
2
2
 
3
3
  [![Domainic::Type Version](https://img.shields.io/gem/v/domainic-type?style=for-the-badge&logo=rubygems&logoColor=white&logoSize=auto&label=Gem%20Version)](https://rubygems.org/gems/domainic-type)
4
4
  [![Domainic::Type License](https://img.shields.io/github/license/domainic/domainic?logo=opensourceinitiative&logoColor=white&logoSize=auto&style=for-the-badge)](./LICENSE)
5
- [![Domainic::Type Open Issues](https://img.shields.io/github/issues-search/domainic/domainic?label=open%20issues&logo=github&logoSize=auto&query=is%3Aopen%20label%3Adomainic-type&color=red&style=for-the-badge)](https://github.com/domainic/domainic/issues?q=state%3Aopen%20label%3Adomainic-type%20)
5
+ [![Domainic::Type Docs](https://img.shields.io/badge/rubydoc-blue?style=for-the-badge&logo=readthedocs&logoColor=white&logoSize=auto&label=docs)](https://rubydoc.info/gems/domainic-type/0.1.0)
6
+ [![Domainic::Type Open Issues](https://img.shields.io/github/issues-search/domainic/domainic?query=state%3Aopen%20label%3Adomainic-type&color=red&style=for-the-badge&logo=github&logoColor=white&logoSize=auto&label=issues)](https://github.com/domainic/domainic/issues?q=state%3Aopen%20label%3Adomainic-type%20)
6
7
 
7
8
  > [!IMPORTANT]
8
9
  > We're running an experiment with Domainic::Type! Help us explore flexible type validation in Ruby by trying our
9
- > [alpha release](../docs/experiments/domainic-type-alpha-3/README.md). Your feedback is invaluable for shaping
10
- > the future of domain-driven design in Ruby.
10
+ > [alpha release](https://github.com/domainic/domainic/wiki/experiments-domainic-type-alpha-3). Your feedback is
11
+ > invaluable for shaping the future of domain-driven design in Ruby.
11
12
 
12
- A flexible type validation system for Ruby, offering composable, readable type constraints with elegant error messages.
13
+ A flexible type validation system for Ruby that brings the power of composable constraints and crystal-clear error
14
+ messages to your domain models. Domainic::Type provides a rich set of built-in types that know how to validate
15
+ themselves, intelligently handle various formats, and tell you exactly what's wrong when validation fails.
13
16
 
14
- Stop wrestling with complex type validations and unclear error messages. Domainic::Type brings type validation to Ruby
15
- that is both powerful and delightful to use. Build composable type constraints with crystal-clear error messages that
16
- actually tell you what went wrong. From simple type checks to complex collection validations, make your types work for
17
- you, not against you!
17
+ This is particularly useful when building domain-driven applications, where strong type validation and clear error
18
+ handling are essential. Instead of writing repetitive validation code and complex error messages, let Domainic::Type
19
+ bring type safety to your Ruby code in a way that feels natural and expressive.
20
+
21
+ ## Quick Start
22
+
23
+ ```ruby
24
+ require 'domainic/type/definitions'
25
+ include Domainic::Type::Definitions
26
+
27
+ # Type validation with clear error messages
28
+ username = _String
29
+ .being_lowercase
30
+ .being_alphanumeric
31
+ .having_size_between(3, 20)
32
+
33
+ username.validate!("ABC123")
34
+ # => TypeError: Expected String(being lowercase), got String(not lowercase)
35
+
36
+ # Rich collection validation
37
+ admin_list = _Array
38
+ .of(_String)
39
+ .being_distinct
40
+ .being_ordered
41
+ .excluding("root")
42
+
43
+ admin_list.validate!(["admin", "admin", "user"])
44
+ # => TypeError: Expected Array(being distinct), got Array(containing duplicates)
45
+
46
+ # Strong type constraints
47
+ config = _Hash
48
+ .of(_Symbol => _String)
49
+ .containing_keys(:host, :port)
50
+
51
+ config.validate!({ host: 123 })
52
+ # => TypeError: Expected Hash(having values of String), got Hash(having values of Integer)
53
+ ```
18
54
 
19
55
  ## Installation
20
56
 
21
57
  Add this line to your application's Gemfile:
22
58
 
23
59
  ```ruby
24
- gem 'domainic-type', '~> 0.1.0.alpha.3'
60
+ gem 'domainic-type'
25
61
  ```
26
62
 
27
63
  Or install it yourself as:
28
64
 
29
65
  ```bash
30
- gem install domainic-type --pre
66
+ gem install domainic-type
31
67
  ```
68
+
69
+ ## Documentation
70
+
71
+ For detailed usage instructions and examples, see [USAGE.md](./docs/USAGE.md).
72
+
73
+ ## Contributing
74
+
75
+ We welcome contributions! Please see our
76
+ [Contributing Guidelines](https://github.com/domainic/domainic/wiki/CONTRIBUTING) for:
77
+
78
+ * Development setup and workflow
79
+ * Code style and documentation standards
80
+ * Testing requirements
81
+ * Pull request process
82
+
83
+ Before contributing, please review our [Code of Conduct](https://github.com/domainic/domainic/wiki/CODE_OF_CONDUCT).
84
+
85
+ ## License
86
+
87
+ The gem is available as open source under the terms of the [MIT License](./LICENSE).