Run the following:
npm install -g grunt-cli # if not installed yet
npm install
grunt
to execute the demo. Then check output directory.
| node_modules/ | |
| output/ |
| 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 | |
| } | |
| } | |
| } |