oly-json
v1.1.1
Published
JSON Schema with decorators to map and validate data.
Readme
oly json
JSON Schema with decorators to map and validate data.
oly json is a module of the oly project.
import { Kernel } from "oly";
import { field, Json } from "oly-json";
class Data {
@field name: string;
}
const kernel = Kernel.create();
const json = kernel.get(Json);
json.schema(Data); // {properties: [{name: ...
json.build(Data, {name: "John"}); // Data { name: "John" }
json.build(Data, {fake: "John"}); // throw ValidationExceptionInstallation
$ npm install oly oly-jsonDependencies
| | | |--|--| | JSON-Schema Validator | ajv |
