1
我使用以下版本:使用外部定义中扬鞭/ Zircote/Nelmio-API文档
zircote/swagger-php in version 2.0.10
nelmio/api-doc-bundle in version v3.0.0-BETA4
一举
/**
* @Operation(
* tags={"DeliverySlip"},
* summary="Send information after deliveryItems are processed and deliverySlip was scanned",
* @SWG\Response(
* response="200",
* description="Returned when successful"
* ),
* @SWG\Response(
* response="400",
* description="Returned on a missing request parameter"
* ),
* @SWG\Response(
* response="500",
* description="Returned on any other error"
* ),
* @SWG\Parameter(
* name="slipIdentifier",
* description="identifier of delivery slip",
* type="string",
* format="string",
* in="path"
* ),
* @SWG\Parameter(
* name="JSON update body",
* in="body",
* description="json login request object",
* required=true,
* @SWG\Schema(ref="#/definitions/product")
* )
*)
*
* @Put("/deliveryslip/update/{slipIdentifier}", requirements={"slipIdentifier" = "\w+"})
*
* @param string $slipIdentifier
* @param Request $request
* @return JsonResponse
*/
public function updateDeliverySlipAction($slipIdentifier, Request $request)
这是型号/定义我想用我的控制器在我的控制器,操作:
<?php
namespace Sendis\Presentation\RestBundle\Model;
use Swagger\Annotations as SWG;
/**
* @SWG\Definition(
* definition="product",
* type="object",
* required={"name"}
*)
*/
class Product
{
/**
* @SWG\Property(example="doggie")
* @var string
*/
public $name;
}
但是,当我去我的文档页面在/ API /文档,我看到这个错误:
Errors
Resolver error at paths./api/deliveryslip/update/{slipIdentifier}.put.parameters.1.schema.$ref
Could not resolve reference: #/definitions/product
我认出了接下来的事情: 我product.php似乎并没有被swagger
在所有阅读。我可以在这里写任何我想要的东西。没有错误,即使我拼错了一些东西。这使我得出结论,我的product.php根本没有找到swagger
。
我对每一个提示都很有帮助。
亲切的问候, 最大