在没有模型引用的情况下,在正文中为请求编写Swagger文档



如何在没有模型引用的情况下为body中的请求编写Swagger文档?

例如:

@SWGParameter( 
name="date",
in="body",
content="application/json",
type="object",
{custom written JSON}
)

我试着在描述中这样做,但那行不通因为它必须显示在CCD_ 1字段中。

请求也是如此。

我搜索过谷歌,但没有找到解决方案
这样的事情可能发生吗?

您可以这样做,但不是很明显。这对我有效:

/**
* @SWGGet(
*  path="/route",
*  tags={"tag"},
*  @SWGResponse(
*      response="200",
*      description="Simple list of name and value pairs ",
*      @SWGSchema(
*          type="array",
*          @SWGItems(
*                  @SWGProperty(
*                      property="id",
*                      type="string"
*                  ),
*                  @SWGProperty(
*                      property="name",
*                      type="string"
*                  )
*          )
*      )
*  )
* )
*/

最新更新