datamocker
v0.0.1
Published
data mocker for json-schema.
Downloads
3
Maintainers
Readme
datamocker
data mocker for json-schema.
Available keywords ( for now )
- enum
- properties
- items
- minItems
- maxItems
- minLength
- maxLength
- multipleOf
- minimum
- maximum
- exclusiveMinimum
- exclusiveMaximum
Usage
var DataMocker = require( 'datamocker' );
var schema = {
"type": "object",
"description": "activity info",
"properties": {
"state": {
"type": "string",
"description": "current activity state",
"enum": ["wait", "process", "over"]
},
"deadline": {
"type": "number",
"description": "deadline of the activity"
},
"remainDays": {
"type": "integer",
"description": "days left."
}
},
"required": ["state", "deadline", "remainDays", "needDays", "seasonNum"]
}
console.log( DataMocker( schema ) );
Will output:
{
state: 'wait',
deadline: 5268.8,
remainDays: 1460,
needDays: 3315,
seasonNum: 4
}