domainic-type 0.1.0.alpha.3.2.0 → 0.1.0.alpha.3.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 24abfbef9f478a43dce3382a737ceec2ea4310f69454d5d3e8903699f97454a0
4
- data.tar.gz: aaede220a86b78362f4dd2a8e51ffdb320ba7352a88b4980dec244e7452662fc
3
+ metadata.gz: 5342f3d3bb47776a4cb27404a0a244d8e0d2761f14de0fc1efe0638ac354c387
4
+ data.tar.gz: e5c55975ec267fba4623239df150111b6bb13eda48448ff4e026007e50342578
5
5
  SHA512:
6
- metadata.gz: 22de008f6805303b6540c879a35a11366c41e49be7dc7ca76347436afaedf256e5b19d8de9242e0351ab0ba78bb6eebf6ad3a202c105b1523ba414836e3a5c64
7
- data.tar.gz: 1eb03da0104dcd61ca5149471ae71f774206f342e01d23e73e71917db7189610346d7432d6f9ef9c0ef5a3f92767ec048905adb2004578d99fc7be82faf6c2b6
6
+ metadata.gz: c1563338aa961165140ef8d72d22c04d9f46e5c08fd95c02b037d32b74f21570b136c7b07094093b4dd47c59b5be6b7cfaa003114ced0e4aad963a15305088e5
7
+ data.tar.gz: 01751a3ccf57ddea40d185aa6d04e12ea7a78bd94c0770aeb4af8dbd449d43ac0eec5eda64f91fe1828ff05ab0e2a53d8b24b78f4c13347c9fbaeae343be928b
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).