Project

jsv.rb

0.0
No commit activity in last 3 years
No release in over 3 years
Provides access to JSV, a JSON Schema validator, from Ruby
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 0
 Project 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