A Ruby wrapper around JSV
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
js
lib
node_modules
script
spec
vendor
.gitignore
.gitmodules
.travis.yml
CHANGELOG
DEVELOPMENT
Gemfile
JSV_LICENSE
LICENSE
README
Rakefile
USAGE
jsv.rb.gemspec
lockdown.json
package.json

README

1. jsv.rb

Some applications process very complex JSON documents.  In some cases,
application developers have encoded expectations for those documents in JSON
Schema, and would like to be able to use those schemas to validate input.

Gary Court's JSV[1] is by far the most complete JSON Schema validator
available, and it makes sense to build upon the work that has gone into JSV
rather than try to reimplement it.

This is a library for Ruby applications that builds a distribution of JSV
suitable for use in ExecJS.  It also contains a Ruby shim for communicating
with JSV.

jsv.rb was written at Northwestern University's Biomedical Informatics
Center[2] for use in NCS Navigator Cases[3].  It embeds JSV 4.0.2.

2. Usage

The short version:

    require 'jsv'

    schema = %Q{{"properties":{"foo":{"type":"integer"}}}}

    jsv = JSV::Context.new
    env = jsv.create_environment
    report = env.validate('{"foo":"bar"}', schema)

    report.has_errors?  # => true
    report.errors       # => a list of errors; see JSV's documentation for
                        #    error object structure

See USAGE for more details.

3. License

Copyright (c) 2013 David Yip.  Made available under the MIT License; see
LICENSE for details.

4. Special thanks

she, Kap Slap, Starsmith, Neon Indian, Florence + the Machine.

[1]: https://github.com/garycourt/JSV
[2]: http://projects.nubic.northwestern.edu/
[3]: https://github.com/NUBIC/ncs_navigator_core

# vim:ts=2:sw=2:et:tw=78