integer 整型数字
- 非枚举mock:
"minimum": 5, // 最小值
"maximum": 8, // 最大值
"default": "6", // 默认值
"exclusiveMinimum": true, // 开启后,必须大于最小值
"exclusiveMaximum": true // 开启后,必须小于最大值
- 枚举mock:
"enum": [200,500] // 整型数字枚举
"enumDesc": "200代表。。。" // 枚举备注
number 浮点数字
- 非枚举mock:
"minimum": 5.6, // 最小值
"maximum": 6.5, // 最大值
"exclusiveMinimum": true, // 开启后,必须大于最小值
"exclusiveMaximum": true, // 开启后,必须小于最大值
"default": "5.7", // 默认值
- 枚举mock:
"enum": [5.9, 6.6] // 浮点数字枚举
"enumDesc": "枚举备注" // 枚举备注
boolean 布尔类型
- "default": true
- "default": false
string 字符串类型
- 非枚举mock:
"minLength": 3, // 最小长度
"maxLength": 8, // 最大长度
"default": "AAA", // 默认值
"pattern": “/[0-9]+/” // 正则表达式
- 枚举mock:
"enum": ["AAA","BBB"] //字符串枚举
"enumDesc": "枚举备注" // 枚举备注
- 特定类型设定:
- 列举各种类型format,以及mock数据举例
- "format": "url" -> "tn3270://usqcywwwc.museum/gilcx"
- "format": "domain" -> "hnfpg.hk"
- "format": "ip" -> "250.75.216.18"
- "format": "id" -> "610000199805128365"
- "format": "guid" -> "ECDfbd5d-AfA4-bB6F-2eE4-dfD7E4cB9eAe"
- "format": "now" -> "2020-03-09 16:56:25"
- "format": "timestamp" -> "1583744210"
- "format": "date" -> "1987-07-28"
- "format": "time" -> "16:08:18"
- "format": "datetime" -> "2006-02-25 12:56:22"
- "format": "image" -> "http://dummyimage.com/160x600"
- "format": "imageData" -> "@imageData"
- "format": "email" -> "m.imqdv@zhkm.sc"
- "format": "paragraph" -> "Yogvimq sqe jtudoy mxegh xbffx lwsglwv dzsbpwwl tfkhu pthovf uinh tke icxzkfk cqwj. Vsv kim inface bpld rjzyc mpouq lhmon bbcqbsq jusic klmc kyrjhimz kbqssug. Ggwypju oglwmds davyhlhr ncowxtpm qmdqxu ibavi rkb ojdlq fwwwig kiuzfkqvpp lbowpg ikwv svljnlbl qqqigokb. Wufe fvjmqsyel ligp irbxgoca hnmgqgqhw oqlgpghe ikss grmu mzut ylunnh yjt tgxvyscdc cqlfbyy rcloqv pzvmhdg mtovhe. Xcw scaw nwlmdysulv wpbvogz mrqhgslj klqprhg fmobsdnpj vawaq utobtdvmmf zrc pbjf phrrheqgp tkih emgcssqxm. Xiahyfhueh jdtxonpug hxnhv gfqqtjtxf nkrgujuenp swd ybjhrnuj imcow hgvxiovz usbb rrpiuv qhtlkrzfn."
- "format": "sentence" -> "Mtpdk gpeqv shrqxy jqcwvym ocesqvav euqplqqi emojixce gksosbyix cfxbplof ozmhqpe wmkn bxwpwamyym gfgywvymv tqnt mtzsyrl tidum lhlxrokwih."
- "format": "word" -> "hzlpxyttvp"
- "format": "title" -> "Dtuedrny Bpdplxxkcj Xxwhlwsylf Kkieebuyx Effm Jvxfqino"
- "format": "name" -> "Paul Wilson"
- "format": "region" -> "format": "region"
- "format": "province" -> "黑龙江省"
- "format": "city" -> "徐州市"
- "format": "county" -> "乾安县"
- "format": "mobile" -> "15102496969"
- "format": "cparagraph" -> "器通史南信利政院理同规给两干团列是。与下革位节小持十省却度委需共府因。东解处被五关片区每头容七大统较。机文观再年才他第何年解流不步。指矿定回打却农周来值各儿之。红验同包习农物素速各类全只程车面。家品情住高拉参除学表切样众选边般马。"
- "format": "cname" -> "林霞"
- "format": "ctitle" -> "六员完意发"
- 列举各种类型format,以及mock数据举例
来源:oschina
链接:https://my.oschina.net/u/3847203/blog/3190604