Comments (5)
我提了pr #48 来实现了这个功能,望沟通采纳。
from egg-swagger-doc.
关于enum的使用 可以参考如下
createUserRequest: { userName: { type: 'string', required: true, description: '用户姓名' }, sexy: { type: 'string', required: true, enum: ['male', 'female'], description: '用户性别' }, age: { type: 'integer', required: true, min: 1, description: '年龄' }, group: { type: 'integer', required: true, min: 1, description: '组别' }, isLeader: { type: 'boolean', required: true, description: '是否小组负责人' }, email: { type: 'string', required: false, example: '[email protected]', format: /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/, description: '邮箱' }, phoneNumber: { type: 'string', required: false, example: '18801731528', format: /^1[34578]\d{9}$/, description: '电话' }, },
from egg-swagger-doc.
关于enum的使用 可以参考如下
createUserRequest: { userName: { type: 'string', required: true, description: '用户姓名' }, sexy: { type: 'string', required: true, enum: ['male', 'female'], description: '用户性别' }, age: { type: 'integer', required: true, min: 1, description: '年龄' }, group: { type: 'integer', required: true, min: 1, description: '组别' }, isLeader: { type: 'boolean', required: true, description: '是否小组负责人' }, email: { type: 'string', required: false, example: '[email protected]', format: /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/, description: '邮箱' }, phoneNumber: { type: 'string', required: false, example: '18801731528', format: /^1[34578]\d{9}$/, description: '电话' }, },
里面的sexy
是一个枚举,但无法设置为required:false
,也无法设置默认值。
from egg-swagger-doc.
恩...是在生成validate rule的时候,规则漏掉了.........
from egg-swagger-doc.
默认值的话你可以试着用 example去设置
from egg-swagger-doc.
Related Issues (20)
- Failed to load API definition. HOT 1
- readme中提到的/swaagger-ui.html HOT 1
- 本项目长时间停更,替换项目推荐! HOT 2
- 返回验证码图片解决办法
- 怎么支持 swagger3.0
- 'eg: '设置request参数example无法生效 识别为description HOT 2
- contract如何用ts定义
- 一个项目两套api HOT 2
- swagger-ui.html的Errors,请问这个Errors是啥问题? HOT 1
- 怎么样设置contract让字段为空时不检验,不为空时检验正则呢
- 自动生成路由,怎么注入中间件
- \
- 动态路由匹配 HOT 3
- @Controller 报错,以下是代码片段
- fix: 解决意外加载TypeScript声明文件`.d.ts`报错问题
- README.md中/swaagger-ui.html 路径错误
- Controller删除后,swagger-doc里仍存在
- 关于 securityDefinitions 不起作用的解决方案
- 关于swagger的默认路径配置问题
- 这个项目是停止维护了吗? 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 egg-swagger-doc.