打开 API/Swagger Symfony 注释?

Open API/Swagger Symfony Annotations?

我正在尝试使用 swagger-php 设置 Open API 2(fka swagger),但我无法找到使用注释的实现示例 内容类型:application/x-www-form-urlencoded

只有 yaml 示例,例如 following

以那个例子为例,如果我有端点

POST https://url.co.uk
Host: server.example.com
Authorization: Bearer <Initial Access Token>
Content-Type: application/x-www-form-urlencoded

&grant_type=password
&client_id=<client id>
&client_secret=<client secret>

如何在 Api annotations 上为 Symfony/PHP 项目表达?

来自https://github.com/zircote/swagger-php/blob/2.x/Examples/petstore.swagger.io/controllers/PetController.php#L228

@SWG\Post(
    consumes={"application/x-www-form-urlencoded"},
    produces={"application/xml", "application/json"},
)

或者,如果您目前使用 3-d 版本,从 https://github.com/zircote/swagger-php/blob/master/Examples/petstore.swagger.io/controllers/PetController.php#L241

@OA\RequestBody(
     *       required=false,
     *       @OA\MediaType(
     *           mediaType="application/x-www-form-urlencoded"
     *       )
     *   ),