-
Notifications
You must be signed in to change notification settings - Fork 12
/
app.js
31 lines (31 loc) · 984 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var json_schema_1 = require("./lib/json-schema");
var refs = {
yep: {
type: 'string', pattern: '^\\d{3}$'
}, a: {
type: 'array', items: {
type: 'object', properties: {
num: { type: 'number' }, str: { type: 'string' }
}
}
}, idSpec: {
type: 'object', properties: {
id: { $ref: 'yep' }, arr: { $ref: 'a' }
}
}
};
// noinspection ReservedWordAsName
var valid = {
type: 'object', properties: {
id: { $ref: 'yep' }, arr: { $ref: 'a' }, address: {
type: 'object', properties: {
street: { type: 'integer', default: 44, minimum: 0, maximum: 50 },
houseColor: { type: 'string', default: '[Function=Date.now]', format: 'date-time' }
}
}
}
};
var result = json_schema_1.default(refs, valid);
console.dir(result, { depth: null });