I use lib: darkaonline/l5-swagger (^5.5) (which contains swagger-php + swagger-ui), I need to change header Content-Type in my POST request to upload file (to read it in Laravel Input::file('photo') ). I read that I should add consumes
and produces
parameters to my swagger - this is what i have:
/**
*
* Create Building Photo
*
* @SWG\Post(
* path="/api/v1/buildings/{buildingId}/photo",
* security={{"oauth2": {"*"}}},
* tags={"building"},
* consumes={"text/plain", "application/json"},
* produces={"text/plain", "application/json"},
* description="Update building",
* @SWG\Parameter(
* name="buildingId",
* in="path",
* description="Building id",
* required=true,
* type="number",
* ),
* @SWG\Parameter(
* name="photo",
* in="formData",
* required=true,
* description="Building photo",
* type="file",
* ),
* @SWG\Response( response=200, description="ok"),
* @SWG\Response( response=404, description="Building not found"),
* )
*
*/
But in request Content-type
and Accept
I always get application/json
and laravel is unable to read uploaded file (when I generate request using swagger-ui). How I should change above swagger to to allow laravel read Input::file('photo') form POST request generated by swagger-ui ?