2017-12-22 18 views
0

私はちょうどlaravel 5.1(古いプロジェクト)のためにswaggerを設定しました 私のプロジェクトのドキュメントは全部書いてありますが、問題はそれが行くときです。 試してみてください! 空の要求を送信します。 そして、私は郵便配達員とまったく同じことをしようとすると、そのように動作します。空白の投稿要求を送信するスワッガー

これは一例です:

/** 
* @SWG\Post(
*  path="/api-routes/verify-report", 
*  consumes={"multipart/form-data"}, 
*  description="Verify report", 
*  operationId="verifyReport", 
*  @SWG\Parameter(
*   description="Application report id", 
*   format="int64", 
*   in="path", 
*   name="report_id", 
*   required=true, 
*   type="string" 
* ),   
*  produces={"application/json"}, 
*  @SWG\Response(
*   response="200", 
*   description="successful operation" 
* ), 
*  summary="Verify report", 
*  tags={ 
*   "Verify report" 
*  } 
*) 
* */ 
public function verifyReport() { 

} 

そして私は

"darkaonline/l5-swagger": "~3.0" 
+0

「空のリクエスト」とは、本文がないリクエストを意味しますか?もしそうなら、あなたのコードの注釈が、要求のためのパラメータ(この場合は 'in =" formData "パラメータ)を定義していない可能性があります。それとも別のことを意味していますか? – Helen

答えて

4

を使用していますが、ちょうどこの怒鳴るようないくつかの変更を変更する必要があります。

/** 
* @SWG\Post(
*  path="/api-routes/verify-report", 
*  consumes={"multipart/form-data"}, 
*  description="Verify report", 
*  operationId="verifyReport", 
*  consumes={"application/x-www-form-urlencoded"}, 
*  produces={"application/json"}, 
*  @SWG\Parameter(
*   description="Application report id", 
*   in="forData", 
*   name="report_id", 
*   required=false, 
*   type="string" 
* ), 
*  @SWG\Response(
*   response="200", 
*   description="successful operation" 
* ), 
*  summary="Verify report", 
*  tags={ 
*   "Verify report" 
*  } 
*) 
* */ 
public function verifyReport() { 

} 
関連する問題