Add JSON Schema Validator
authorAndrey Goder <agoder@fb.com>
Sat, 7 Mar 2015 00:06:18 +0000 (16:06 -0800)
committerAndre Azevedo <aap@fb.com>
Wed, 18 Mar 2015 02:47:03 +0000 (19:47 -0700)
commite87194b349a6dc0c584911945f6f41dcbaa32b6b
treedb197c0621eb2600ddf081a8fe1e78b955335412
parent88fb213fe19af92f50ee851a477c73a103dbcfe1
Add JSON Schema Validator

Summary:
This is a validator for  JSON schema (http://json-schema.org/) that works on
folly::dynamic. Apparently there are no good open source ones for C++,
especially not if you want to use folly::dynamic. I am going to use this to
validate JSON configs.

It supports basically everything from the standard, except for fetching schemas
via http, and using id refs. It supports enough to check schemas against the
metaschema.

Currently you can define a schema that will crash on validation, if it's
infinitely self-recursive. See the unit test case that reproduces this.
Fixing this seems hard though, so I didn't bother. It would also probably
be slower for normal usage.

Test Plan: unit test

Reviewed By: lesha@fb.com

Subscribers: trunkagent, folly-diffs@, yfeldblum

FB internal diff: D1847657

Signature: t1:1847657:1425605163:635dc523aeda1b588c3634d0dc1a48d50a53db79
folly/Makefile.am
folly/experimental/JSONSchema.cpp [new file with mode: 0644]
folly/experimental/JSONSchema.h [new file with mode: 0644]
folly/experimental/JSONSchemaTester.cpp [new file with mode: 0644]
folly/experimental/test/JSONSchemaTest.cpp [new file with mode: 0644]