php - 如何设置,该参数值在 nelmio api doc 中可以为空?
问题描述
我在 Symfony Flex 中有一个 API,使用 NelmioApiDocBundle 进行了记录。在文档中,我想显示,该parentPOSId
参数可以是 int 或 null。我该怎么做?
这是我的控制器注释:
/**
*
* @FOSRest\Post("/pos/parent")
*
* @SWG\Post(
* tags={"pos_parent"},
* description="set POS parent",
* @SWG\Response(
* response=200,
* description="Parent was set",
* examples={
* "application/json":{
* "POSId":2,
* "parentPOSId": 1
* }
* }
* ),
*
* @SWG\Parameter(
* name="form",
* in="body",
* description="Action parameters",
* @Model(type=App\Domain\Port\POSParent\SetPOSParentInterface::class)
* )
* )
*
*/
这是我的模型:
namespace App\Domain\Port\POSParent;
interface SetPOSParentInterface
{
public function getPOSId():int;
public function getParentPOSId():?int;
}
解决方案
推荐阅读
- jooq - 使用 Jooq 作为 SQL Builder
- genexus - GeneXus 16 .NET U10 - 导入 OpenAPI - 支持 OpenAPI 3.0.0?
- nuxt.js - 如何检查应用程序的 Nuxt.js 版本?
- windows - 在 Windows 中禁用文件协议
- javascript - 未收到来自 PHP 的 json 响应,并且 PHP 错误日志或控制台中没有错误
- c# - SSIS脚本任务获取csv文件的行数
- reactjs - 为什么在 React 应用程序中使用 @import 来使用谷歌字体?
- c# - 正则表达式自定义开始和结束引号.Net
- scala - 编译|构建错误 Maven [错误]:xsbti.CompileFaile
- spring - 如何从外部 Jar 中自动装配实体?