proxygen
folly::jsonschema Namespace Reference

Classes

struct  Validator
 

Functions

std::unique_ptr< ValidatormakeValidator (const dynamic &schema)
 
std::shared_ptr< ValidatormakeSchemaValidator ()
 

Function Documentation

std::shared_ptr< Validator > folly::jsonschema::makeSchemaValidator ( )

Makes a validator for schemas. You should probably check your schema with this before you use makeValidator().

Definition at line 1037 of file JSONSchema.cpp.

Referenced by check(), and TEST().

1037  {
1038  return schemaValidator.try_get();
1039 }
std::unique_ptr< Validator > folly::jsonschema::makeValidator ( const dynamic schema)

Make a validator that can be used to check various json. Thread-safe.

Definition at line 1029 of file JSONSchema.cpp.

References context, and folly::gen::move.

Referenced by check(), main(), and TEST().

1029  {
1030  auto v = std::make_unique<SchemaValidator>();
1031  SchemaValidatorContext context(schema);
1032  context.refs["#"] = v.get();
1033  v->loadSchema(context, schema);
1034  return std::move(v);
1035 }
context
Definition: CMakeCache.txt:563
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
const dynamic & schema
Definition: JSONSchema.cpp:103