Skip to content

TuRing-CDS/cds-mock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TuRing-CDS

cds-mock

How to use

npm install cds-mock --save

Example

schema.json

{
    "title":"user",
    "properties":{
        "id":{
            "description":"The unique identifier for user",
            "type":"integer"
        },
        "userName":{
            "description":"Name of the user",
            "type":"string",
            "minLength":"6",
            "maxLength":"12"
        },
        "nickName":{
            "description":"NickName of the user",
            "type":"string",
        }
    },
    "required":["id","userName"]
}

Test.js

const Mock = require('cds-mock')

const schema = require('./schema.json');

Mock.mock(schema)

=> { id: 10001, userName:"xxaegxgxg", nickName: "乱七八糟啥的"}

About

模拟生成数据,基于mockjs和jsonschema

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published