php - 在没有模型引用的情况下为正文中的请求编写 Swagger 文档
问题描述
如何在没有模型引用的情况下为正文中的请求编写 Swagger 文档?
例如:
@SWG\Parameter(
name="date",
in="body",
content="application/json",
type="object",
{custom written JSON}
)
我试图在描述中做到这一点,但这不起作用,因为它必须在Edit Value
现场显示。
请求也类似。
我已经搜索了谷歌,但没有找到解决方案。
这样的事情可能吗?
解决方案
你可以做到,但不是很明显。这对我有用:
/**
* @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"
* )
* )
* )
* )
* )
*/
推荐阅读
- javascript - SignalR js 2 示例未在 2019 年调用
- react-native - 如何设置我的视图样式以将内容包装在里面
- vb.net - 无法读取一个数字,打印输出,然后在 VB 中移动到下一个数字
- python-3.x - 使用python在亚马逊选择产品尺寸后如何获取价格值?
- java - 如何在Android上将POST请求加载到带有标题和正文的Webview
- cardano - 可以创建私人卡尔达诺网络吗?
- angular - 如何为此端点结果制作域模型?
- sql - 带有运算符的 PostgreSQL CASE WHEN 返回空行
- php - 使用php在shopify中添加脚本标签
- css - 我需要帮助在引导程序 4 中订购列