Create a gist now

Instantly share code, notes, and snippets.

@ducin /.gitignore
Last active Jan 23, 2016

Embed
What would you like to do?
Grunt JSON-Schema-faker basic demo
node_modules/
output/

Grunt JSON-Schema-faker demo

Run the following:

npm install -g grunt-cli # if not installed yet
npm install
grunt

to execute the demo. Then check output directory.

module.exports = function (grunt){
grunt.initConfig({
jsonschema_faker: {
options: {
indent: 2
},
sample: {
src: 'sample.json',
dest: 'output/sample.json',
options: {
size: 20
}
}
}
});
grunt.loadNpmTasks('grunt-jsonschema-faker');
// By default, run jsf
grunt.registerTask('default', ['jsonschema_faker']);
};
{
"name": "jsf-demo",
"description": "Grunt JSON-Schema-faker demo gist",
"dependencies": {
"grunt": "^0.4.5",
"grunt-jsonschema-faker": "^0.2.3"
}
}
{
"type": "object",
"properties": {
"user": {
"type": "object",
"properties": {
"id": {
"$ref": "#/definitions/positiveInt"
},
"name": {
"type": "string",
"faker": "name.findName"
},
"email": {
"type": "string",
"format": "email",
"faker": "internet.email"
}
},
"required": ["id", "name", "email"]
}
},
"required": ["user"],
"definitions": {
"positiveInt": {
"type": "integer",
"minimum": 0,
"exclusiveMinimum": true
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment