在没有模型引用的情况下为正文中的请求编写 Swagger 文档
Writing Swagger documentation for requests in body without model referencing
如何在没有模型引用的情况下为 body 中的请求编写 Swagger 文档?
例如:
@SWG\Parameter(
name="date",
in="body",
content="application/json",
type="object",
{custom written JSON}
)
我已经在描述中尝试这样做了,但是那是行不通的
因为它必须显示在 Edit Value
字段中。
请求也类似。
我搜索了 google,但没有找到解决方案。
这样的事情可能吗?
你可以做到,但不是很明显的方式。这对我有用:
/**
* @SWG\Get(
* path="/route",
* tags={"tag"},
* @SWG\Response(
* response="200",
* description="Simple list of name and value pairs ",
* @SWG\Schema(
* type="array",
* @SWG\Items(
* @SWG\Property(
* property="id",
* type="string"
* ),
* @SWG\Property(
* property="name",
* type="string"
* )
* )
* )
* )
* )
*/
如何在没有模型引用的情况下为 body 中的请求编写 Swagger 文档?
例如:
@SWG\Parameter(
name="date",
in="body",
content="application/json",
type="object",
{custom written JSON}
)
我已经在描述中尝试这样做了,但是那是行不通的
因为它必须显示在 Edit Value
字段中。
请求也类似。
我搜索了 google,但没有找到解决方案。
这样的事情可能吗?
你可以做到,但不是很明显的方式。这对我有用:
/**
* @SWG\Get(
* path="/route",
* tags={"tag"},
* @SWG\Response(
* response="200",
* description="Simple list of name and value pairs ",
* @SWG\Schema(
* type="array",
* @SWG\Items(
* @SWG\Property(
* property="id",
* type="string"
* ),
* @SWG\Property(
* property="name",
* type="string"
* )
* )
* )
* )
* )
*/