json-schema-faker.js
const jsf = require('json-schema-faker');
const scheme = {
type: 'array',
minItems: 5,
maxItems: 7,
uniqueItems: true,
items: {
type: 'object',
properties: {
id: {
type: 'integer',
minimum: 0,
exclusiveMinimum: true
},
name: {
type: 'string',
faker: 'name.findName'
},
birthday: {
type: 'string',
chance: {
birthday: {
string: true
}
}
},
email: {
type: 'string',
format: 'email',
faker: 'internet.email'
}
},
required: ['id']
}
};
jsf(scheme) // ->
/*
[
{
"id": 57276331,
"birthday": "in magna enim culpa et",
"name": "aliquip ut commodo"
},
{
"id": 58495270
},
{
"id": 58213387
},
{
"id": 41650832
},
{
"id": 76147691,
"birthday": "laborum conse",
"name": "in laboris in sunt"
},
{
"id": 41061949,
"birthday": "aliqua proident offi"
},
{
"id": 98969169,
"email": "ie3aoDCIZjSm@Lxaw.vio",
"birthday": "ex sit",
"name": "Ut commodo"
}
]
*/