Skip to content

Commit

Permalink
Improve Documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias Rahn committed Oct 30, 2023
1 parent 4c4b8df commit 9d302de
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change log

## 3.0.25 (2023-10-30)

* Improve documentation: list validation

## 3.0.24 (2023-05-15)

* Add `require_key` option
Expand Down
13 changes: 7 additions & 6 deletions README_V3.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ The nodes in Schemacop v3 also support generic keywords, similar to JSON schema:
value is not in the array, the validation will fail
* `default`: You may provide a default value for items that will be set if the
value is not given
* `require_key`: If set to true, validate that the key of this node is present,
regardless of the value (including `nil`). This is only validated if the
* `require_key`: If set to true, validate that the key of this node is present,
regardless of the value (including `nil`). This is only validated if the
schema type is set to `:hash`.
Example:
```ruby
Expand Down Expand Up @@ -673,10 +673,11 @@ how you specify your array contents.

List validation validates a sequence of arbitrary length where each item matches
the same schema. Unless you specify a `min_items` count on the array node, an
empty array will also suffice. To specify a list validation, use the `list` DSL
method, and specify the type you want to validate against. Here, you need to
specify the type of the element using the long `type` name (e.g. `integer` and
not `int`).
empty array will also suffice. If the option `required: true` is not specified,
a list containing only `nil` values is also valid. To specify a list validation,
use the `list` DSL method, and specify the type you want to validate against.
Here, you need to specify the type of the element using the long `type` name
(e.g. `integer` and not `int`).

For example, you can specify that you want an array with only integers between 1 and 5:

Expand Down

0 comments on commit 9d302de

Please sign in to comment.