如何让php swagger选择我的HTTP get方法

如何让php swagger选择我的HTTP get方法,php,get,annotations,swagger,Php,Get,Annotations,Swagger,} 注意,它忽略了GET方法HTTP操作?? 我认为注释的这种精确语法在几个小时前工作得很好,但我必须改变一些东西,因为现在它不再工作了。。。。 有什么想法吗?嗯,奇怪,现在我删除了GET的整个注释,重新编写并重新插入它,它就工作了……现在我找到了忽略GET方法的原因。 事实证明,即使注释结构100%正确,php swagger也会忽略任何包含选项卡的docblock。 希望这能帮助别人 <?php /** * @SWG\Resource( * basePath="http:

}

注意,它忽略了GET方法HTTP操作?? 我认为注释的这种精确语法在几个小时前工作得很好,但我必须改变一些东西,因为现在它不再工作了。。。。
有什么想法吗?

嗯,奇怪,现在我删除了GET的整个注释,重新编写并重新插入它,它就工作了……

现在我找到了忽略GET方法的原因。 事实证明,即使注释结构100%正确,php swagger也会忽略任何包含选项卡的docblock。 希望这能帮助别人

<?php
/**
 * @SWG\Resource(
 *      basePath="http://dizplayzone.com/api",
 *      resourcePath="/account",
 *      description="Read information on a company dashboard",
 *      swaggerVersion="1.2",
 *      apiVersion="1.1",
 * )
 */

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\JsonResponse;

$account = $app['controllers_factory'];

/**
 *      /account/{id}
 *      ------------------------------------------------------------------------
 *
 *      @SWG\Api(
 *              path="/account/{id}",
 *              @SWG\Operation(
 *                      method="GET",
 *                      summary="Returns info from a company dashboard",
 *                      notes="Returns info from a company dashboard",
 *                      type="account",
 *                      nickname="view_account",
 *                      @SWG\Parameter(
 *                              name="id",
 *                              description="Company ID",
 *                              required=true,
 *                              type="integer",
 *                              paramType="path"
 *                      ),
 *                      @SWG\ResponseMessage(code=404, message="Bad, really bad name.")
 *              ),
 *      )
 *
 *
 * @trans foo,bar
 *
 */

 $account->get('/account/{id}', function ($id) use ($app) {

  ...


    return "Welcome {$user['username']}!";
 });

/**
 *      /account/{id}
 *      ------------------------------------------------------------------------
 *
 *      @SWG\Api(
 *              path="/account/{id}",
 *              @SWG\Operation(
 *                      method="POST",
 *                      summary="Add info to a company dashboard",
 *                      notes="Add info to a company dashboard",
 *                      type="account",
 *                      nickname="post_to_account",
 *                      @SWG\Parameter(
 *                              name="id",
 *                              description="Company ID",
 *                              required=true,
 *                              type="integer",
 *                              paramType="path"
 *                      ),
 *                      @SWG\ResponseMessage(code=404, message="Bad, really bad name.")
 *              )
 *      )
 *
 *
 */

$account->post('/account/{id}', function ($id) use ($app) {

 ....
});

return $account;
{
"basePath":"http://dizplayzone.com/api",
"swaggerVersion":"1.2",
"apiVersion":"1.1",
"resourcePath":"/account",
"apis":[
    {
        "path":"/account/{id}",
        "operations":[
            {
                "method":"POST",
                "summary":"Add info to a company dashboard",
                "nickname":"post_to_account",
                "type":"account",
                "parameters":[
                    {
                        "paramType":"path",
                        "name":"id",
                        "type":"integer",
                        "required":true,
                        "description":"Company ID"
                    }
                ],
                "responseMessages":[
                    {
                        "code":404,
                        "message":"Bad, really bad name."
                    }
                ],
                "notes":"Add info to a company dashboard"
            }
        ]
    }
]