Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Master #21

Merged
merged 1 commit into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading