【发布时间】:2015-08-30 01:38:17
【问题描述】:
我正在使用 Restler 框架来编写我的 API,它使用 swagger 来记录事物。当我定义我的方法时,生成的文档有两个问题。一是参数的描述没有大张旗鼓地显示,二是说它们都是必需的。如何在文档中将它们标记为可选?我正在做类似下面的事情,其中类别和图片是可选参数。
/**
* Create a new News post
*
* Creates a new News post
*
* @param string $title The title of the task.
* @param string $url The URL of the webpage to display.
* @param string $body The text of the news article.
* @param int $team_id The sql_ident of the Team this news article relates to.
* @param string $categories The comma separated list of categories.
* @param string $picture The URL to the picture to display.
*
* @status 201
*
* @return array The sql_ident of the new article
*/
function post($title, $url, $body, $team_id, $categories = '', $picture = '') {
【问题讨论】: