Comments (8)
应该是toJSONSchema吧
from mock.
@Bosn 嗯
from mock.
2014.12.24 纪要
-
RAP 输出的 JSON Schema 需要把数据的规则结构化
完善输出的 JSON Schema,对应的 Java 代码在 这里
常用类型:Number,String
-
占位符(标签)
-
RAP 原封不动的输出
-
IF-Test 和 Mock 共建占位符(标签)基础库
-
IF-Test 扩展的占位符(标签)可以共用在 RAP 和 IF-Test(包括验证)
-
IF-Test 建立占位符(标签)的验证规则
Mock.js 也会扩展和建立占位符(标签)的验证规则,但是不用在 Mock-RAP-IFTest 的生态里。参考
river/mock/blob/master/lib/river-mock.js
。优先保证占位符(标签)基础库的一致。
-
-
Mock Service 验证
占位符(标签)基础库
2014.12.24
Type | Method |
---|---|
Basics | boolean, natural, integer, float, character, string |
Date | date, time, datetime |
Image | image |
Web | url, domain, email, ip |
DDDeadLine
2014.12.26
- 确定占位符(标签)基础库的方法签名和行为
- 前面的第 1 条
from mock.
占位符标签的基础库,已经开发完成尽办。简单举个例子:
如下是是个jsonchema:
{
"title": "custom format attribute demonstration",
"type": "array",
"items": {
"type": "object",
"properties": {
"naturalNum": {
"type": "number",
"iftest": "@natural(5,10)"
},
"isSuccess": {
"type": "boolean",
"iftest": "@boolean(5,10)"
},
"userMock": {
"type": "string",
"iftest": "@mock=sdff"
}
}
}
}
下面是data:
[
{
"naturalNum":456
},
{
"isSuccess":false
},
{
"userMock":"sdff"
}
]
结果是:
--- BEGIN MESSAGES ---
error: 超出范围
level: "error"
schema: {"loadingURI":"#","pointer":"/items/properties/naturalNum"}
instance: {"pointer":"/0/naturalNum"}
domain: "validation"
keyword: "iftest"
argumentList: ["5","10"]
failed: ["456"]
--- END MESSAGES ---
rap这边需要调整的是querySchema接口,对于原本
"format":"MOCKJS|A-PART|B-PART"
的输出要更改为:
"iftest":"A-PART|B-PART"
@Bosn @nuysoft 明天找个15分钟我们电话会议下
from mock.
会议纪要:
1、@Bosn 按照如上修改querySchema接口
2、DEADLINE为:1月23日(周五)完成,包括开发机部署
感谢!么么哒!
from mock.
type:web的情况要扩种一种方法
@url(host,path,query)
例如:要mock 天猫宝贝详情的detail:
http://detail.tmall.com/item.htm?id=41156775172&spm=a1z09.5.0.0.otr1cg
则为:@url('detail.tmall.com','item.htm','id')
大概是这个意思,不是很严禁,里面的参数可以再细化
@nuysoft 你看呢?
from mock.
我想了下改成这样易用性会更好
@url()
@url(example)
@url(example,type)
type=protocal/host/path/query/all,缺省是all
例如:@url('http://detail.tmall.com/item.htm?id=41156775172&spm=a1z09.5.0.0.otr1cg', 'query')
那么仅仅会验证data是url,同时,有两个参数,且为id和spm
from mock.
目前if-validator已经支持了mockjs方法如下:
Type | Method |
---|---|
Basics | boolean, natural, integer, float, character, string |
Date | date, time, datetime |
Image | image |
Web | url |
Other | (data) |
Other 的example:
{
"type":"string",
"iftest:"data"
}
yes:
"data"
no:
"sdf"
from mock.
Related Issues (20)
- http://mockjs.com/ 域名到期了,不能访问了 HOT 2
- mockjs.com到期了怎么办?自己搞一个 HOT 7
- 你们的官网域名到期了
- bug: 重写了upload属性为空对象{},导致业务中使用到xhr.upload. addEventListener时报错 HOT 4
- 先行断言的字符数量配置无效
- Mock.mock的回调函数可以获取请求的header信息吗?
- Mock.mock('@drange') 不生效 HOT 1
- 用mockjs拦截以后如何读取header中的数据 HOT 1
- req.header 有值吗? HOT 1
- How to use mock.js to generate response that has status 403 or 400 ? HOT 3
- 打包后get发送数组参数,接收只能接收到数组参数的最后一个
- 关于mockjs嵌套url匹配问题 HOT 1
- 响应头Content-Security-Policy "script-src 'self' 导致不能使用eval【BUG】 HOT 3
- 如何生成指定一个指定内容,随机长度的数组? HOT 7
- 返回的数据丢失属性值
- 版本1.1.0使用正则
- 希望不要将 "commander" 的版本设定成 "*" HOT 8
- 作者有支持ts类型的计划吗? HOT 3
- 🤩早在2019年,这个库就不在维护了,各位另寻出路 HOT 4
- react+vite 项目下载mockjs 和 vite-plugin-mock 提示npm包高等漏洞 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mock.