A tool for describing and validating objects as intuitively as possible.
Katachi.compare(
value: {name: 'John', age: 30},
shape: {name: String, age: Integer}
).match? # => trueFind out more at jtannas.github.io/katachi.
Install the gem and add to the application's Gemfile by executing:
$ bundle add katachiIf bundler is not being used to manage dependencies, install the gem by executing:
$ gem install katachi- More shapes (e.g.
:$email,:$url,:$iso_8601) - More "matching modifiers" (e.g.
all_of,one_of,none_of) - More output formats (e.g.
to_json,to_hash, etc...) - Custom shape codes (e.g.
:email_is_invalid) - Rails integration (e.g.
validates_shape_of) - Shape-to-TypeScript conversion
- Shape-to-Zod conversion
- Shape-to-OpenAPI conversion
-
katachi-rspec-apifor testing+documenting APIs in a way inspired by RSwag
See CONTRIBUTING.md for information on how to contribute to Katachi. Alternatively, you can check out the Contributing section on the documentation site.
The gem is available as open source under the terms of the MIT License.