philiprehberger-schema_validator 0.3.0 → 0.3.2
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +28 -11
- data/README.md +23 -37
- data/lib/philiprehberger/schema_validator/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 35bb923a89c62125188659f02420a92fe887902eaa0708e2224748785d7600d5
|
|
4
|
+
data.tar.gz: '006509819a5ed58493e9919a303c26be8c21cb7da90921f324a970377e1159e8'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0aaa400e8b96514dabf0cdeb7f077fd3ca6b972cac8f75a1fc9877458d40da8691af83e4173b357c128d8fc4b8c18ce282e339891b0013638690d88db8ffa7a0
|
|
7
|
+
data.tar.gz: 87bcd261785b2da0d60b0789e6e4f28b5d368b40e0342beb22fb1322bbcc341098ef7bcd2a50c3263e1437f99844e772dfede2b0fee06bc7220ea390783ad191
|
data/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,28 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
All notable changes to this gem will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [0.3.2] - 2026-03-24
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
- Standardize README API section to table format
|
|
14
|
+
|
|
15
|
+
## [0.3.1] - 2026-03-22
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
- Remove extra Supported Types section from README for template compliance
|
|
19
|
+
|
|
20
|
+
## [0.3.1] - 2026-03-21
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
- Standardize Installation section in README
|
|
24
|
+
|
|
25
|
+
## [0.3.0] - 2026-03-17
|
|
4
26
|
|
|
5
27
|
### Added
|
|
6
28
|
- Nested schema validation via `nested` DSL method with recursive error prefixing
|
|
@@ -10,24 +32,19 @@
|
|
|
10
32
|
- Cross-field validation via `validate` block at schema level
|
|
11
33
|
- Schema composition via `merge` method to combine and extend schemas
|
|
12
34
|
|
|
13
|
-
## 0.2.2
|
|
35
|
+
## [0.2.2] - 2026-03-16
|
|
14
36
|
|
|
37
|
+
### Fixed
|
|
15
38
|
- Fix rubocop: string interpolation style, ParameterLists cop
|
|
16
39
|
|
|
17
|
-
## 0.2.1
|
|
40
|
+
## [0.2.1] - 2026-03-16
|
|
18
41
|
|
|
19
|
-
|
|
42
|
+
### Changed
|
|
43
|
+
- Remove extra Supported Types section from README for template compliance
|
|
20
44
|
- Add bug_tracker_uri to gemspec
|
|
21
45
|
- Add Development section to README
|
|
22
46
|
- Add Requirements section to README
|
|
23
47
|
|
|
24
|
-
All notable changes to this gem will be documented in this file.
|
|
25
|
-
|
|
26
|
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
27
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
28
|
-
|
|
29
|
-
## [Unreleased]
|
|
30
|
-
|
|
31
48
|
## [0.2.0] - 2026-03-13
|
|
32
49
|
|
|
33
50
|
### Added
|
data/README.md
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
#
|
|
1
|
+
# philiprehberger-schema_validator
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://github.com/philiprehberger/rb-schema-validator/actions/workflows/ci.yml)
|
|
4
|
+
[](https://rubygems.org/gems/philiprehberger-schema_validator)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
|
|
7
|
+
Lightweight schema validation for Ruby hashes with type checking and coercion
|
|
4
8
|
|
|
5
9
|
## Requirements
|
|
6
10
|
|
|
@@ -8,7 +12,7 @@ Lightweight schema validation for Ruby hashes with type checking and coercion.
|
|
|
8
12
|
|
|
9
13
|
## Installation
|
|
10
14
|
|
|
11
|
-
Add
|
|
15
|
+
Add to your Gemfile:
|
|
12
16
|
|
|
13
17
|
```ruby
|
|
14
18
|
gem "philiprehberger-schema_validator"
|
|
@@ -243,47 +247,29 @@ schema = Philiprehberger::SchemaValidator.define do
|
|
|
243
247
|
end
|
|
244
248
|
```
|
|
245
249
|
|
|
246
|
-
## Supported Types
|
|
247
|
-
|
|
248
|
-
| DSL Method | Ruby Type | Coerces From |
|
|
249
|
-
|-------------|-----------|-------------------|
|
|
250
|
-
| `string` | String | any (via `to_s`) |
|
|
251
|
-
| `integer` | Integer | String |
|
|
252
|
-
| `float` | Float | String |
|
|
253
|
-
| `boolean` | Boolean | String (true/false/yes/no/1/0/on/off) |
|
|
254
|
-
| `array` | Array | - |
|
|
255
|
-
| `hash_field`| Hash | - |
|
|
256
|
-
|
|
257
250
|
## API
|
|
258
251
|
|
|
259
|
-
### `
|
|
260
|
-
|
|
261
|
-
Creates a new schema using the DSL block.
|
|
262
|
-
|
|
263
|
-
### `Schema#fields` -> `Array<Symbol>`
|
|
264
|
-
|
|
265
|
-
Returns the list of defined field names.
|
|
266
|
-
|
|
267
|
-
### `Schema#validate(data)` -> `Result`
|
|
268
|
-
|
|
269
|
-
Validates a hash against the schema. Returns a `Result` object.
|
|
270
|
-
|
|
271
|
-
### `Schema#validate!(data)` -> `Result`
|
|
272
|
-
|
|
273
|
-
Validates and raises `ValidationError` if invalid.
|
|
274
|
-
|
|
275
|
-
### `Schema#merge(&block)` -> `Schema`
|
|
276
|
-
|
|
277
|
-
Creates a new schema combining the current schema with additional definitions from the block.
|
|
252
|
+
### `SchemaValidator`
|
|
278
253
|
|
|
279
|
-
|
|
254
|
+
| Method | Description |
|
|
255
|
+
|--------|-------------|
|
|
256
|
+
| `.define(&block)` | Create a new schema using the DSL block |
|
|
280
257
|
|
|
281
|
-
|
|
258
|
+
### `Schema`
|
|
282
259
|
|
|
283
|
-
|
|
260
|
+
| Method | Description |
|
|
261
|
+
|--------|-------------|
|
|
262
|
+
| `#fields` | Return the list of defined field names |
|
|
263
|
+
| `#validate(data)` | Validate a hash against the schema; returns a `Result` |
|
|
264
|
+
| `#validate!(data)` | Validate and raise `ValidationError` if invalid |
|
|
265
|
+
| `#merge(&block)` | Create a new schema combining current fields with additional definitions |
|
|
284
266
|
|
|
285
|
-
|
|
267
|
+
### `Result`
|
|
286
268
|
|
|
269
|
+
| Method | Description |
|
|
270
|
+
|--------|-------------|
|
|
271
|
+
| `#valid?` | Return `true` if there are no errors |
|
|
272
|
+
| `#errors` | Array of error message strings |
|
|
287
273
|
|
|
288
274
|
## Development
|
|
289
275
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: philiprehberger-schema_validator
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Philip Rehberger
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-03-
|
|
11
|
+
date: 2026-03-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: A zero-dependency Ruby gem for validating hash data against schemas with
|
|
14
14
|
type checking, coercion, required/optional fields, and custom validators.
|
|
@@ -37,6 +37,7 @@ metadata:
|
|
|
37
37
|
source_code_uri: https://github.com/philiprehberger/rb-schema-validator
|
|
38
38
|
changelog_uri: https://github.com/philiprehberger/rb-schema-validator/blob/main/CHANGELOG.md
|
|
39
39
|
rubygems_mfa_required: 'true'
|
|
40
|
+
bug_tracker_uri: https://github.com/philiprehberger/rb-schema-validator/issues
|
|
40
41
|
post_install_message:
|
|
41
42
|
rdoc_options: []
|
|
42
43
|
require_paths:
|
|
@@ -45,7 +46,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
45
46
|
requirements:
|
|
46
47
|
- - ">="
|
|
47
48
|
- !ruby/object:Gem::Version
|
|
48
|
-
version:
|
|
49
|
+
version: 3.1.0
|
|
49
50
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
50
51
|
requirements:
|
|
51
52
|
- - ">="
|