在 API 蓝图中,我希望为 POST 消息指定一个可选的 json 元素。
示例;
### Add a new User [POST]
To add a User send a JSON .....
+ Request (application/json)
{
"name": "A name",
"age": 30
}
如何向 API 的读者表明年龄在 API 调用中是可选的,但仍显示它是一个整数?
~Colin
我推荐像这样的文档字段表。
### Source Fields
| field | required | type | example | description |
|------------|:-:|-------------|----------------------------------------|-------------|
| name | * | string | `average-lead-time-frontend` | Unique name for machines, used as reference key and for url usage. |
| title | * | string | `Average Lead Time Frontend` | Title for humans. |
| sourcetype | * | string | `team-avgLeadTime` | Source type identificator. |
| groups | | list | `["engagement-analytics", "builder"]` | List of groups where entity is member. |
| options | | object | `{ "team": 21926 }` | Addition options for sourcetype. |
| data | | list | `[70.3, 31.8]` | Actual data held by Source. |
Generated table of fields: https://i.stack.imgur.com/cxocx.png https://i.stack.imgur.com/cxocx.png
![enter image description here](https://i.stack.imgur.com/cxocx.png)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)