# json_schema_mock

> data mocker for json-schema base on json-schema-mock

Latest version **1.0.3** (published 2015-09-06) · 0 weekly downloads

## Install

```sh
npm install json_schema_mock
pnpm add json_schema_mock
yarn add json_schema_mock
bun add json_schema_mock
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2015-09-06 |
| First published | 2015-09-02 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 (+6 in 2 direct dependencies) |
| Install scripts | no |
| Maintainers | zqbright |

## Links

- npm: https://www.npmjs.com/package/json_schema_mock
- npm.io page: https://npm.io/package/json_schema_mock

## Dependencies (3)

- [lodash](https://npm.io/package/lodash.md) ^2.4.1
- [mockjs](https://npm.io/package/mockjs.md) ^0.1.1
- [json-schema-format](https://npm.io/package/json-schema-format.md) 0.0.2

## Recent versions

- 1.0.3 (latest) — 2015-09-06
- 1.0.2 — 2015-09-06
- 1.0.1 — 2015-09-06
- 1.0.0 — 2015-09-02

## README

## json_schema_mock

data mocker for json-schema.
#### 根据json-schema-mock 进行改造 

#### Available keywords ( for now )

- enum
- properties
- items
- minItems
- maxItems
- minLength
- maxLength
- multipleOf
- minimum
- maximum
- exclusiveMinimum
- exclusiveMaximum
- allOf,oneOf,anyOf
- format 具体类型支持参考：[json-schema-format](http://gitlab.taobao.ali.com/jsonnanny/json-schema-format/tree/master)

#### Usage

```
var DataMocker = require( 'json-schema-mock' );
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
}
```

---
_Source: https://npm.io/package/json_schema_mock · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
