README.md in api_client_base-1.1.0 vs README.md in api_client_base-1.2.0
- old
+ new
@@ -156,9 +156,40 @@
end
end
end
```
+##### Validation
+
+APIClientBase supports validation so that your calls fail early before even hitting the server. The validation library that this supports (by default, and the only one) is dry-validations.
+
+Given this request:
+
+```ruby
+module MyGem
+ class GetUserRequest
+ attribute :user_id, Integer
+ end
+end
+```
+
+Create a dry-validations schema following this pattern:
+
+```ruby
+module MyGem
+ GetUserRequestSchema = Dry::Validation.Schema do
+ required(:user_id).filled(:int?)
+ end
+end
+```
+
+This will raise an error when you call the method:
+
+```
+client = MyGem::Client.new #...
+client.get_user(user_id: nil) # -> this raises an ArgumentError "[user_id: 'must be filled']"
+```
+
#### Responses
```ruby
module MyGem
class GetUserResponse