Sha256: 332ed7e87d955c49ba0526b691c46f0e7d335ccb792c57bcfb788271ad51444d
Contents?: true
Size: 1.85 KB
Versions: 2
Compression:
Stored size: 1.85 KB
Contents
# Jschematic Jschematic is a JSON Schema Validator for Ruby. Its aim is to validate schemas conforming to the most recent version of the JSON Schema draft standard, which today means v3. Supporting older versions of the standard is not out of the question, but it is not a primary development focus. ## Status Core schema: fully supported Hyper schema: not supported The format attribute supports only these formats: * date-time * date * ip-address * ipv6 * uri Adding ad-hoc support for different formats should be relatively painless. Look in jschematic/attributes/format.rb to get started. Please report any bugs you find in the issue tracker here: https://github.com/msassak/jschematic/issues. ## Basic Usage require 'jschematic' Jschematic.validate(json, schema) # => true or false Jschematic.validate!(json, schema) # => true or raise Jschematic::ValidationError `json` and `schema` above must be Ruby data structures, not real JSON. Jschematic doesn't care how you turn JSON into Ruby (though we use the fine yajl-ruby gem for testing). ## Advanced Usage Pass extra schemas to inform the validation context: Jschematic.validate(json, schema, :context => [cs1, cs2]) Each context schema will be consulted in those cases where cross-schema referencing is allowed, e.g. $ref. To enable debugging support, set :debug to true in the options hash: Jschematic.validate!(json, schema, :debug => true) With debugging on a warning is printed when schema contain unknown attributes. ## Testing $ cucumber $ rspec spec Or `rake` if you want to run both. ## Links * http://tools.ietf.org/html/draft-zyp-json-schema-03 * https://github.com/kriszyp/json-schema * http://tools.ietf.org/html/rfc3986 * https://groups.google.com/d/topic/json-schema/lftABvH5KkA/discussion ## Copyright Copyright (c) 2011 Mike Sassak. See LICENSE for details.
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
jschematic-0.1.0 | README.md |
jschematic-0.0.9 | README.md |