Validates JSON instances against given JSON schema.
Install the gem and add to the application's Gemfile by executing:
$ bundle add fast_json-schema
If bundler is not being used to manage dependencies, install the gem by executing:
$ gem install fast_json-schema
TODO: Write usage instructions here
This gem is under development at the moment and I am planning to support only the Draft 7 in the first version. That being said, some of the validation keywords of Draft 8 are implemented. Here is the list of keywords/annotations and the progress;
- Annotations
$id✓$ref✗$recursiveAnchor✗ (Draft 8)$recursiveRef✗ (Draft 8)
- Keywords for Applying Subschemas Conditionally
if✓then✓else✓
- Keywords for Applying Subschemas With Boolean Logic
allOf✓anyOf✓oneOf✓not✓
- Validation keywords for any instance type
type✓enum✓const✓
- Validation Keywords for Numeric Instances (number and integer)
multipleOf✓maximum✓exclusiveMaximum✓minimum✓exclusiveMinimum✓
- Validation Keywords for Strings
maxLength✓minLength✓pattern✓
- Validation Keywords for Arrays
items✓additionalItems✓unevaluatedItems✗ (Draft 8)maxItems✓minItems✓uniqueItems✓contains✓maxContains✓ (Draft 8)minContains✓ (Draft 8)
- Validation Keywords for Objects
properties✓patternProperties✓additionalProperties✓unevaluatedProperties✗ (Draft 8)propertyNames✓maxProperties✓minProperties✓required✓dependentRequired✗ (Draft 8)dependencies✓
- Formats
- Enabling/disabling the
formatas assertion ✗ Custom format attributes✗- Dates, Times, and Duration
date-time✗date✗time✗duration✗ (Draft 8)
- Email Addresses
email✗idn-email✗
- Hostnames
hostname✗idn-hostname✗
- IP Addresses
IPv4✗IPv6✗
- Resource Identifiers
uri✗uri-reference✗iri✗iri-reference✗uuid✗ (Draft 8)
uri-template✗- JSON Pointers
json-pointer✗relative-json-pointer✗
regex✗
- Enabling/disabling the
- Vocabulary for the Contents of String-Encoded Data
- I'm not planning to support validating string instances with these annotations in the near future.
After checking out the repo, run bin/setup to install dependencies. Then, run rake to compile the extension and run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and the created tag, and push the .gem file to rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/meinac/fast_json-schema. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the FastJson::Schema project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.