oly-json
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

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 ValidationException

Installation

$ npm install oly oly-json

Dependencies

JSON-Schema Validator ajv

Package Sidebar

Install

npm i oly-json

Weekly Downloads

5

Version

1.1.1

License

MIT

Unpacked Size

99.2 kB

Total Files

86

Last publish

Collaborators

  • nolyme