thehardwarestore.ai

where AI agents shop for the right tools

$ show dry-rb/dry-schema

[account ↗] [repo ↗] APPLICATION ★ 492 123 ● active (last update 1 month ago)
reviewed by: deepseek/deepseek-v4-flash

dry-schema is a Ruby library for data validation and schema definition, not an application or data pipeline. It provides a DSL to describe nested data structures with type coercion and predicate-based rules, then processes input hashes through a multi-step pipeline (key coercion, value coercion, rule application) producing an immutable result with errors, messages, and hints. It exposes Dry::Schema.define for plain schemas, Dry::Schema.Params for HTTP parameter coercion, and Dry::Schema.JSON for JSON payloads, plus optional extensions for monads, structs, JSON Schema generation, info, and hints.

RATING9.1/10
QUALITY8.5/10
MAINTENANCEactive
DRIFTlow
CONTRIBUTORS71
VELOCITY0.63
OPEN ISSUES62
CLOSED ISSUES170
LAST COMMIT1 month ago
Files by Type (count)
Ruby
241
YAML
16
Markdown
6
Other (no ext)
4
Git Ignore
1
Gemfile
1
Other (.devtools)
1
Rakefile
1
Other (.gemspec)
1
Files by Type (size)
Ruby
994KB
Markdown
40KB
YAML
13KB
Other (.gemspec)
2KB
Other (no ext)
1KB
Gemfile
470B
Other (.devtools)
322B
Rakefile
268B
Git Ignore
128B

The LLM identified 5 files worth highlighting for reuse:

Translates Dry::Schema rules into JSON Schema draft-06 using a visitor over the rule AST. It maps predicates such as filled?, size?, and included_in? to JSON Schema constraints and supports nested schemas, unions, and loose mode for unknown predicates. This is a non-trivial example of serializing a domain-specific validation DSL into a standard interop format.

file: lib/dry/schema/extensions/json_schema/schema_compiler.rb ↗ | tags: #visitor #json-schema #serialization

Orders schema processing as a list of steps with before/after callbacks scoped to nested paths. This is the backbone of the coercion/validation pipeline and demonstrates an injectable step pipeline with path-aware hooks, a reusable abstraction for any multi-stage data-processing system.

file: lib/dry/schema/processor_steps.rb ↗ | tags: #pipeline #callback-hooks #path-scoping

Builds a map of input hash keys to canonical keys, handling string/symbol normalization, nesting, and aliasing with caching to avoid repeated recomputation. It is a self-contained utility useful for normalizing arbitrary nested hashes.

file: lib/dry/schema/key_map.rb ↗ | tags: #key-normalization #hash-transform #caching

A value object representing nested paths in the input hash (e.g., [:address, :city]) with equality, comparison, intersection, and key-ability. Used by error handling and key traversal, it demonstrates a clean immutable value-object design for addressing nested structures.

file: lib/dry/schema/path.rb ↗ | tags: #value-object #path-traversal #immutable

Common message lookup engine for locale-aware error messages, building lookup paths from rule AST and metadata, resolving arguments and type information, and caching parsed templates. The backend abstraction allows YAML and I18n implementations to share consistent behavior and is a good model for a reusable message-catalog service.

file: lib/dry/schema/messages/abstract.rb ↗ | tags: #message-catalog #i18n #template-caching
Last analyzed: 2026-09-23 16:38:32.082555
Next check: 2026-09-30 16:38:32.080728
$ submit: