This is a CLI for json-schema-faker.
npm install -g json-schema-faker-cli
- (required) file (path) containing JSON schema
- (optional) generated file (path) according to the provided schema
- (optional) number of objects in the array (when you want to generate an array of multiple objects matching the schema)
- (optional) file (path) containing options (in JS or JSON format)
generate-json schema.json output.json
generate-json schema.json output.json $ITEMS_LENGTH
generate-json schema.json output.json none options.js
You can use any of the json-schema-faker available options.
an example options file:
module.exports = {
minLength: 20,
random: () => 0.2,
};
generate-json schema.json
You can pass none
to skip any of the optional params. It's useful when you need to pass a following param when skipping some of the previous params at the same time.