slampenny / swaggervel Goto Github PK
View Code? Open in Web Editor NEWSwagger for Laravel
Swagger for Laravel
hi @slampenny
when I use this package on Laravel 5.4 then I browse to http://127.0.0.1:8000/api/docs it show error:
FatalErrorException in Facade.php line 221:
Call to undefined method Illuminate\View\Compilers\BladeCompiler::setEscapedContentTags()
can u tell me how to fix this error?
is it because the new laravel (5.4) version that made changes on Blade Compiler?
Many thank
After I set the package, on vendor:publish I get this error message:
[ErrorException]
mkdir(): Invalid path
My laravel version is 5.2.20
When i access localhost:8000/docs: Cannot find /home/aurelio/laravel/laravelgenerator/storage/docs/api-docs.json
I made all configurations, step by step, but when i generate some resource the api-docs.json is not created.
obs: my storage directory is free to write and read.
I use [[ ]] insrtead of {{ and }} for my blade syntax, is there any way it can detect this and generate those instead? (since i use angular more in the views) In my global.php i have this:
Blade::setContentTags('[[', ']]');
Blade::setEscapedContentTags('[[[', ']]]');
But.. if you could just at this in your vendor/jlapp/swaggervel/src/Jlapp/Swaggervel/routes.php it would also solve my issue (and wont hurt others afaik)
Blade::setEscapedContentTags('{{{', '}}}');
Blade::setContentTags('{{', '}}');
return View::make('swaggervel::index');
(in the route for api-docs)
Hi,
I have a working documentation etc. on my system. When I copy the project to a remote server I get the following exception:
[Semantical Error] The annotation "@Swagger\Annotations\GET" in \helpa\Http\Controllers\UsersController->getUsers() in /var/www/helpa/app/Http/Controllers/UsersController.php on line 14 does not exist, or could not be auto-loaded.
in Logger.php line 38
at HandleExceptions->handleError('512', '[Semantical Error] The annotation "@Swagger\Annotations\GET" in \helpa\Http\Controllers\UsersController->getUsers() in /var/www/helpa/app/Http/Controllers/UsersController.php on line 14 does not exist, or could not be auto-loaded.', '/var/www/helpa/vendor/zircote/swagger-php/src/Logger.php', '38', array('entry' => '[Semantical Error] The annotation "@Swagger\Annotations\GET" in \helpa\Http\Controllers\UsersController->getUsers() in /var/www/helpa/app/Http/Controllers/UsersController.php on line 14 does not exist, or could not be auto-loaded.', 'type' => '512'))
at trigger_error('[Semantical Error] The annotation "@Swagger\Annotations\GET" in \helpa\Http\Controllers\UsersController->getUsers() in /var/www/helpa/app/Http/Controllers/UsersController.php on line 14 does not exist, or could not be auto-loaded.', '512') in Logger.php line 38
at Logger->Swagger\{closure}(object(AnnotationException), '512')
at call_user_func(object(Closure), object(AnnotationException), '512') in Logger.php line 59
at Logger::warning(object(AnnotationException)) in Analyser.php line 99
at Analyser->fromComment('/** * Display a listing of the resource. * * @return \Illuminate\Http\JsonResponse * @SWG\Definition( * definition="Users", * required={"userid", "type", "firstname", "lastname", "avatar"}, * @SWG\Property( * property="userid", * type="string" * ), * @SWG\Property( * property="type", * type="string" * ), * @SWG\Property( * property="firstname", * type="string" * ), * @SWG\Property( * property="lastname", * type="string" * ), @SWG\Property( * property="avatar", * type="string" * ) * ), * * @SWG\GET( * path="/api/users/all", * description="Returns users list with minimum information.", * operationId="api.users.getUsers", * produces={"application/json"}, * tags={"1. Users"}, * @SWG\Response( * response=200, * description="Show users list with minimum information.", * @SWG\Schema( * ref="#/definitions/Users" * ) * ), * @SWG\Response( * response=401, * description="Unauthorized action.", * @SWG\Schema( * ref="#/definitions/ErrorResponse" * ) * ) * ) */', object(Context)) in StaticAnalyser.php line 244
at StaticAnalyser->analyseComment(object(Analysis), object(Analyser), '/** * Display a listing of the resource. * * @return \Illuminate\Http\JsonResponse * @SWG\Definition( * definition="Users", * required={"userid", "type", "firstname", "lastname", "avatar"}, * @SWG\Property( * property="userid", * type="string" * ), * @SWG\Property( * property="type", * type="string" * ), * @SWG\Property( * property="firstname", * type="string" * ), * @SWG\Property( * property="lastname", * type="string" * ), @SWG\Property( * property="avatar", * type="string" * ) * ), * * @SWG\GET( * path="/api/users/all", * description="Returns users list with minimum information.", * operationId="api.users.getUsers", * produces={"application/json"}, * tags={"1. Users"}, * @SWG\Response( * response=200, * description="Show users list with minimum information.", * @SWG\Schema( * ref="#/definitions/Users" * ) * ), * @SWG\Response( * response=401, * description="Unauthorized action.", * @SWG\Schema( * ref="#/definitions/ErrorResponse" * ) * ) * ) */', object(Context)) in StaticAnalyser.php line 175
at StaticAnalyser->fromTokens(array(array('376', '<?php ', '1'), array('379', ' ', '2'), array('385', 'namespace', '3'), array('379', ' ', '3'), array('310', 'helpa', '3'), array('388', '\', '3'), array('310', 'Http', '3'), array('388', '\', '3'), array('310', 'Controllers', '3'), ';', array('379', ' ', '3'), array('344', 'use', '5'), array('379', ' ', '5'), array('310', 'helpa', '5'), array('388', '\', '5'), array('310', 'ConnectionsModel', '5'), ';', array('379', ' ', '5'), array('344', 'use', '6'), array('379', ' ', '6'), array('310', 'helpa', '6'), array('388', '\', '6'), array('310', 'Domain', '6'), array('388', '\', '6'), array('310', 'Model', '6'), array('388', '\', '6'), array('310', 'User', '6'), array('388', '\', '6'), array('310', 'User', '6'), ';', array('379', ' ', '6'), array('344', 'use', '7'), array('379', ' ', '7'), array('310', 'helpa', '7'), array('388', '\', '7'), array('310', 'UserModel', '7'), ';', array('379', ' ', '7'), array('344', 'use', '8'), array('379', ' ', '8'), array('310', 'Illuminate', '8'), array('388', '\', '8'), array('310', 'Http', '8'), array('388', '\', '8'), array('310', 'Request', '8'), ';', array('379', ' ', '8'), array('344', 'use', '9'), array('379', ' ', '9'), array('310', 'Illuminate', '9'), array('388', '\', '9'), array('310', 'Http', '9'), array('388', '\', '9'), array('310', 'Response', '9'), ';', array('379', ' ', '9'), array('344', 'use', '10'), array('379', ' ', '10'), array('310', 'helpa', '10'), array('388', '\', '10'), array('310', 'Domain', '10'), array('388', '\', '10'), array('310', 'Services', '10'), array('388', '\', '10'), array('310', 'ConnectionStatuses', '10'), ';', array('379', ' ', '10'), array('358', 'class', '12'), array('379', ' ', '12'), array('310', 'UsersController', '12'), array('379', ' ', '12'), array('361', 'extends', '12'), array('379', ' ', '12'), array('310', 'Controller', '12'), array('379', ' ', '12'), '{', array('379', ' ', '13'), array('375', '/** * Display a listing of the resource. * * @return \Illuminate\Http\JsonResponse * @SWG\Definition( * definition="Users", * required={"userid", "type", "firstname", "lastname", "avatar"}, * @SWG\Property( * property="userid", * type="string" * ), * @SWG\Property( * property="type", * type="string" * ), * @SWG\Property( * property="firstname", * type="string" * ), * @SWG\Property( * property="lastname", * type="string" * ), @SWG\Property( * property="avatar", * type="string" * ) * ), * * @SWG\GET( * path="/api/users/all", * description="Returns users list with minimum information.", * operationId="api.users.getUsers", * produces={"application/json"}, * tags={"1. Users"}, * @SWG\Response( * response=200, * description="Show users list with minimum information.", * @SWG\Schema( * ref="#/definitions/Users" * ) * ), * @SWG\Response( * response=401, * description="Unauthorized action.", * @SWG\Schema( * ref="#/definitions/ErrorResponse" * ) * ) * ) */', '14'), array('379', ' ', '64'), array('347', 'public', '66'), array('379', ' ', '66'), array('337', 'function', '66'), array('379', ' ', '66'), array('310', 'getUsers', '66'), '(', array('310', 'Request', '66'), array('379', ' ', '66'), array('312', '$request', '66'), ')', array('379', ' ', '66'), '{', array('379', ' ', '67'), array('312', '$users', '68'), array('379', ' ', '68'), '=', array('379', ' ', '68'), array('310', 'User', '68'), array('384', '::', '68'), array('310', 'getUsers', '68'), '(', ')', ';', array('379', ' ', '68'), array('312', '$usersResource', '70'), array('379', ' ', '70'), '=', array('379', ' ', '70'), '[', ']', ';', array('379', ' ', '70'), array('375', '/** @var User $user */', '72'), array('379', ' ', '72'), array('325', 'foreach', '73'), array('379', ' ', '73'), '(', array('312', '$users', '73'), array('379', ' ', '73'), array('329', 'as', '73'), array('379', ' ', '73'), array('312', '$user', '73'), ')', array('379', ' ', '73'), '{', array('379', ' ', '73'), array('312', '$userData', '74'), array('379', ' ', '74'), '=', array('379', ' ', '74'), array('312', '$user', '74'), array('363', '->', '74'), array('310', 'toArray', '74'), '(', ')', ';', array('379', ' ', '74'), array('354', 'unset', '75'), '(', array('312', '$userData', '75'), '[', array('318', ''email'', '75'), ']', ')', ';', array('379', ' ', '75'), array('354', 'unset', '76'), '(', array('312', '$userData', '76'), '[', array('318', ''password'', '76'), ']', ')', ';', array('379', ' ', '76'), array('354', 'unset', '77'), '(', array('312', '$userData', '77'), '[', array('318', ''token'', '77'), ']', ')', ';', array('379', ' ', '77'), array('312', '$usersResource', '79'), '[', ']', array('379', ' ', '79'), '=', array('379', ' ', '79'), array('312', '$userData', '79'), ';', array('379', ' ', '79'), '}', array('379', ' ', '80'), array('339', 'return', '82'), array('379', ' ', '82'), array('302', 'new', '82'), array('379', ' ', '82'), array('310', 'Response', '82'), '(', array('310', 'json_encode', '82'), '(', array('312', '$usersResource', '82'), ',', array('379', ' ', '82'), array('310', 'JSON_PRETTY_PRINT', '82'), ')', ')', ';', array('379', ' ', '82'), '}', array('379', ' ', '83'), array('375', '/** * Display a listing of the resource. * *@return \Illuminate\Http\JsonResponse * @SWG\Definition( * definition="Search", * required={"type", "firstname", "lastname"}, * @SWG\Property( * property="type", * type="string" * ), * @SWG\Property( * property="firstname", * type="string" * ), * @SWG\Property( * property="lastname", * type="string" * ) * ), * * @return \Illuminate\Http\JsonResponse * @SWG\GET( * path="/api/users", * description="Returns users by firstname or lastname (or both).", * operationId="api.users.getSearch", * produces={"application/json"}, * tags={"1. Users"}, * @SWG\Parameter( * description="User firstname.", * type="string", * in="query", * name="name" * ), * @SWG\Parameter( * description="User lastname.", * type="string", * in="query", * name="lastname" * ), * @SWG\Response( * response=200, * description="Show users by search words (firstname, lastname).", * @SWG\Schema( * ref="#/definitions/Search" * ) * ), * @SWG\Response( * response=401, * description="Unauthorized action.", * @SWG\Schema( * ref="#/definitions/ErrorResponse" * ) * ) * ) */', '85'), array('379', ' ', '140'), array('347', 'public', '142'), array('379', ' ', '142'), array('337', 'function', '142'), array('379', ' ', '142'), array('310', 'getSearch', '142'), '(', array('310', 'Request', '142'), array('379', ' ', '142'), array('312', '$request', '142'), ')', array('379', ' ', '142'), '{', array('379', ' ', '143'), array('312', '$name', '144'), array('379', ' ', '144'), '=', array('379', ' ', '144'), array('312', '$request', '144'), array('363', '->', '144'), array('310', 'query', '144'), '(', array('318', ''name'', '144'), ')', ';', array('379', ' ', '144'), array('312', '$lastname', '145'), array('379', ' ', '145'), '=', array('379', ' ', '145'), array('312', '$request', '145'), array('363', '->', '145'), array('310', 'query', '145'), '(', array('318', ''lastname'', '145'), ')', ';', array('379', ' ', '145'), array('304', 'if', '147'), array('379', ' ', '147'), '(', array('310', 'is_null', '147'), '(', array('312', '$name', '147'), ')', array('379', ' ', '147'), array('281', '&&', '147'), array('379', ' ', '147'), array('310', 'is_null', '147'), '(', array('312', '$lastname', '147'), ')', ')', array('379', ' ', '147'), '{', array('379', ' ', '147'), array('339', 'return', '148'), array('379', ' ', '148'), array('310', 'response', '148'), '(', ')', array('363', '->', '148'), array('310', 'json', '148'), '(', '[', array('318', '"error"', '148'), array('379', ' ', '148'), array('364', '=>', '148'), array('379', ' ', '148'), array('318', '"Whoops! missing query params."', '148'), ']', ',', array('379', ' ', '148'), array('308', '401', '148'), ')', ';', array('379', ' ', '148'), '}', array('379', ' ', '149'), array('304', 'if', '151'), array('379', ' ', '151'), '(', array('310', 'is_null', '151'), '(', array('312', '$name', '151'), ')', ')', array('379', ' ', '151'), '{', array('379', ' ', '151'), array('312', '$query', '152'), array('379', ' ', '152'), '=', array('379', ' ', '152'), array('366', 'array', '152'), '(', array('379', ' ', '152'), array('318', ''lastname'', '153'), array('379', ' ', '153'), array('364', '=>', '153'), array('379', ' ', '153'), array('312', '$lastname', '153'), array('379', ' ', '153'), ')', ';', array('379', ' ', '154'), '}', array('379', ' ', '155'), array('306', 'else', '155'), array('379', ' ', '155'), array('304', 'if', '155'), array('379', ' ', '155'), '(', array('310', 'is_null', '155'), '(', array('312', '$lastname', '155'), ')', ')', array('379', ' ', '155'), '{', array('379', ' ', '155'), array('312', '$query', '156'), array('379', ' ', '156'), '=', array('379', ' ', '156'), array('366', 'array', '156'), '(', array('379', ' ', '156'), array('318', ''firstname'', '157'), array('379', ' ', '157'), array('364', '=>', '157'), array('379', ' ', '157'), array('312', '$name', '157'), array('379', ' ', '157'), ')', ';', array('379', ' ', '158'), '}', array('379', ' ', '159'), array('306', 'else', '159'), array('379', ' ', '159'), '{', array('379', ' ', '159'), array('312', '$query', '160'), array('379', ' ', '160'), '=', array('379', ' ', '160'), array('366', 'array', '160'), '(', array('379', ' ', '160'), array('318', ''firstname'', '161'), array('379', ' ', '161'), array('364', '=>', '161'), array('379', ' ', '161'), array('312', '$name', '161'), ',', array('379', ' ', '161'), array('318', ''lastname'', '162'), array('379', ' ', '162'), array('364', '=>', '162'), array('379', ' ', '162'), array('312', '$lastname', '162'), array('379', ' ', '162'), ')', ';', array('379', ' ', '163'), '}', array('379', ' ', '164'), array('312', '$users', '166'), array('379', ' ', '166'), '=', array('379', ' ', '166'), array('310', 'User', '166'), array('384', '::', '166'), array('310', 'getUsersByQuery', '166'), '(', array('312', '$query', '166'), ')', ';', array('379', ' ', '166'), array('312', '$usersResource', '168'), array('379', ' ', '168'), '=', array('379', ' ', '168'), '[', ']', ';', array('379', ' ', '168'), array('375', '/** @var User $user */', '170'), array('379', ' ', '170'), array('325', 'foreach', '171'), array('379', ' ', '171'), '(', array('312', '$users', '171'), array('379', ' ', '171'), array('329', 'as', '171'), array('379', ' ', '171'), array('312', '$user', '171'), ')', array('379', ' ', '171'), '{', array('379', ' ', '171'), array('312', '$userData', '172'), array('379', ' ', '172'), '=', array('379', ' ', '172'), array('312', '$user', '172'), array('363', '->', '172'), array('310', 'toArray', '172'), '(', ')', ';', array('379', ' ', '172'), array('354', 'unset', '173'), '(', array('312', '$userData', '173'), '[', array('318', ''userid'', '173'), ']', ')', ';', array('379', ' ', '173'), array('354', 'unset', '174'), '(', array('312', '$userData', '174'), '[', array('318', ''email'', '174'), ']', ')', ';', array('379', ' ', '174'), array('354', 'unset', '175'), '(', array('312', '$userData', '175'), '[', array('318', ''password'', '175'), ']', ')', ';', array('379', ' ', '175'), array('354', 'unset', '176'), '(', array('312', '$userData', '176'), '[', array('318', ''token'', '176'), ']', ')', ';', array('379', ' ', '176'), array('354', 'unset', '177'), '(', array('312', '$userData', '177'), '[', array('318', ''avatar'', '177'), ']', ')', ';', array('379', ' ', '177'), array('312', '$usersResource', '179'), '[', ']', array('379', ' ', '179'), '=', array('379', ' ', '179'), array('312', '$userData', '179'), ';', array('379', ' ', '179'), '}', array('379', ' ', '180'), array('339', 'return', '182'), array('379', ' ', '182'), array('302', 'new', '182'), array('379', ' ', '182'), array('310', 'Response', '182'), '(', array('310', 'json_encode', '182'), '(', array('312', '$usersResource', '182'), ',', array('379', ' ', '182'), array('310', 'JSON_PRETTY_PRINT', '182'), ')', ')', ';', array('379', ' ', '182'), '}', array('379', ' ', '183'), array('375', '/** * Display a listing of the resource. * * @return \Illuminate\Http\JsonResponse * @SWG\Definition( * definition="Friends", * required={"userid", "type", "firstname", "lastname", "avatar", "email"}, * @SWG\Property( * property="userid", * type="string" * ), * @SWG\Property( * property="type", * type="string" * ), * @SWG\Property( * property="firstname", * type="string" * ), * @SWG\Property( * property="lastname", * type="string" * ), * @SWG\Property( * property="email", * type="string" * ), * @SWG\Property( * property="avatar", * type="string" * ) * ), * * @SWG\GET( * path="/api/user/{userId}/connections", * description="Returns user his friends list.", * operationId="api.users.getFriends", * produces={"application/json"}, * tags={"2. Connections"}, * @SWG\Parameter( * description="User token for security.", * type="string", * required=true, * in="header", * name="token" * ), * @SWG\Parameter( * description="User id for security.", * type="string", * required=true, * in="path", * name="userId" * ), * @SWG\Response( * response=200, * description="Show user his friends list.", * @SWG\Schema( * ref="#/definitions/Friends" * ) * ), * @SWG\Response( * response=401, * description="Unauthorized action.", * @SWG\Schema( * ref="#/definitions/ErrorResponse" * ) * ) * ) */', '185'), array('379', ' ', '253'), array('347', 'public', '255'), array('379', ' ', '255'), array('337', 'function', '255'), array('379', ' ', '255'), array('310', 'getFriends', '255'), '(', array('312', '$userId', '255'), ',', array('379', ' ', '255'), array('310', 'Request', '255'), array('379', ' ', '255'), array('312', '$request', '255'), ')', array('379', ' ', '255'), '{', array('379', ' ', '256'), array('312', '$reqUser', '257'), array('379', ' ', '257'), '=', array('379', ' ', '257'), array('310', 'User', '257'), array('384', '::', '257'), array('310', 'getByToken', '257'), '(', array('312', '$request', '257'), array('363', '->', '257'), array('310', 'header', '257'), '(', array('318', ''token'', '257'), ')', ')', ';', array('379', ' ', '257'), array('304', 'if', '259'), array('379', ' ', '259'), '(', array('312', '$reqUser', '259'), array('363', '->', '259'), array('310', 'getUserid', '259'), '(', ')', array('379', ' ', '259'), array('282', '!==', '259'), array('379', ' ', '259'), array('312', '$userId', '259'), ')', array('379', ' ', '259'), '{', array('379', ' ', '259'), array('339', 'return', '260'), array('379', ' ', '260'), array('310', 'response', '260'), '(', ')', array('363', '->', '260'), array('310', 'json', '260'), '(', '[', array('318', '"error"', '260'), array('379', ' ', '260'), array('364', '=>', '260'), array('379', ' ', '260'), array('318', '"Whoops! Not valid token"', '260'), ']', ',', array('379', ' ', '260'), array('308', '401', '260'), ')', ';', array('379', ' ', '260'), '}', array('379', ' ', '261'), array('312', '$pathUser', '263'), array('379', ' ', '263'), '=', array('379', ' ', '263'), array('310', 'User', '263'), array('384', '::', '263'), array('310', 'getById', '263'), '(', array('312', '$userId', '263'), ')', ';', array('379', ' ', '263'), array('304', 'if', '264'), array('379', ' ', '264'), '(', array('310', 'is_null', '264'), '(', array('312', '$pathUser', '264'), ')', ')', array('379', ' ', '264'), '{', array('379', ' ', '264'), array('339', 'return', '265'), array('379', ' ', '265'), array('310', 'response', '265'), '(', ')', array('363', '->', '265'), array('310', 'json', '265'), '(', '[', array('318', '"error"', '265'), array('379', ' ', '265'), array('364', '=>', '265'), array('379', ' ', '265'), array('318', '"Whoops! User not found"', '265'), ']', ',', array('379', ' ', '265'), array('308', '404', '265'), ')', ';', array('379', ' ', '265'), '}', array('379', ' ', '266'), array('312', '$users', '268'), array('379', ' ', '268'), '=', array('379', ' ', '268'), array('310', 'User', '268'), array('384', '::', '268'), array('310', 'getUsers', '268'), '(', ')', ';', array('379', ' ', '268'), array('312', '$userConnections', '269'), array('379', ' ', '269'), '=', array('379', ' ', '269'), array('310', 'ConnectionsModel', '269'), array('384', '::', '269'), array('310', 'getByStatus', '269'), '(', array('310', 'ConnectionStatuses', '269'), array('384', '::', '269'), array('310', 'ACCEPTED', '269'), ')', ';', array('379', ' ', '269'), array('312', '$usersResource', '271'), array('379', ' ', '271'), '=', array('379', ' ', '271'), '[', ']', ';', array('379', ' ', '271'), array('375', '/** @var User $user */', '273'), array('379', ' ', '273'), array('325', 'foreach', '274'), array('379', ' ', '274'), '(', array('312', '$users', '274'), array('379', ' ', '274'), array('329', 'as', '274'), array('379', ' ', '274'), array('312', '$user', '274'), ')', array('379', ' ', '274'), '{', array('379', ' ', '274'), array('304', 'if', '275'), array('379', ' ', '275'), '(', array('312', '$user', '275'), array('363', '->', '275'), array('310', 'getUserid', '275'), '(', ')', array('379', ' ', '275'), array('282', '!==', '275'), array('379', ' ', '275'), array('312', '$reqUser', '275'), array('363', '->', '275'), array('310', 'getUserid', '275'), '(', ')', ')', array('379', ' ', '275'), '{', array('379', ' ', '275'), array('325', 'foreach', '276'), array('379', ' ', '276'), '(', array('312', '$userConnections', '276'), array('379', ' ', '276'), array('329', 'as', '276'), array('379', ' ', '276'), array('312', '$connection', '276'), ')', array('379', ' ', '276'), '{', array('379', ' ', '276'), array('304', 'if', '277'), array('379', ' ', '277'), '(', array('312', '$connection', '277'), '[', array('318', ''id_user_confirmer'', '277'), ']', array('379', ' ', '277'), array('283', '===', '277'), array('379', ' ', '277'), array('312', '$user', '277'), array('363', '->', '277'), array('310', 'getUserid', '277'), '(', ')', array('379', ' ', '277'), array('281', '&&', '277'), array('379', ' ', '277'), array('312', '$connection', '277'), '[', array('318', ''id_user_requester'', '277'), ']', array('379', ' ', '277'), array('283', '===', '277'), array('379', ' ', '277'), array('312', '$reqUser', '277'), array('363', '->', '277'), array('310', 'getUserid', '277'), '(', ')', ')', array('379', ' ', '277'), '{', array('379', ' ', '277'), array('312', '$userData', '278'), array('379', ' ', '278'), '=', array('379', ' ', '278'), array('312', '$user', '278'), array('363', '->', '278'), array('310', 'toArray', '278'), '(', ')', ';', array('379', ' ', '278'), array('354', 'unset', '279'), '(', array('312', '$userData', '279'), '[', array('318', ''password'', '279'), ']', ')', ';', array('379', ' ', '279'), array('354', 'unset', '280'), '(', array('312', '$userData', '280'), '[', array('318', ''token'', '280'), ']', ')', ';', array('379', ' ', '280'), array('312', '$usersResource', '282'), '[', ']', array('379', ' ', '282'), '=', array('379', ' ', '282'), array('312', '$userData', '282'), ';', array('379', ' ', '282'), array('334', 'break', '283'), ';', array('379', ' ', '283'), '}', array('379', ' ', '284'), array('306', 'else', '284'), array('379', ' ', '284'), array('304', 'if', '284'), array('379', ' ', '284'), '(', array('312', '$connection', '284'), '[', array('318', ''id_user_confirmer'', '284'), ']', array('379', ' ', '284'), array('283', '===', '284'), array('379', ' ', '284'), array('312', '$reqUser', '284'), array('363', '->', '284'), array('310', 'getUserid', '284'), '(', ')', array('379', ' ', '284'), array('281', '&&', '284'), array('379', ' ', '284'), array('312', '$connection', '284'), '[', array('318', ''id_user_requester'', '284'), ']', array('379', ' ', '284'), array('283', '===', '284'), array('379', ' ', '284'), array('312', '$user', '284'), array('363', '->', '284'), array('310', 'getUserid', '284'), '(', ')', ')', array('379', ' ', '284'), '{', array('379', ' ', '284'), array('312', '$userData', '285'), array('379', ' ', '285'), '=', array('379', ' ', '285'), array('312', '$user', '285'), array('363', '->', '285'), array('310', 'toArray', '285'), '(', ')', ';', array('379', ' ', '285'), array('354', 'unset', '286'), '(', array('312', '$userData', '286'), '[', array('318', ''password'', '286'), ']', ')', ';', array('379', ' ', '286'), array('354', 'unset', '287'), '(', array('312', '$userData', '287'), '[', array('318', ''token'', '287'), ']', ')', ';', array('379', ' ', '287'), array('312', '$usersResource', '289'), '[', ']', array('379', ' ', '289'), '=', array('379', ' ', '289'), array('312', '$userData', '289'), ';', array('379', ' ', '289'), array('334', 'break', '290'), ';', array('379', ' ', '290'), '}', array('379', ' ', '291'), '}', array('379', ' ', '292'), '}', array('379', ' ', '293'), '}', array('379', ' ', '294'), array('339', 'return', '296'), array('379', ' ', '296'), array('310', 'json_encode', '296'), '(', array('312', '$usersResource', '296'), ',', array('379', ' ', '296'), array('310', 'JSON_PRETTY_PRINT', '296'), ')', ';', array('379', ' ', '296'), '}', array('379', ' ', '297'), '}'), object(Context)) in StaticAnalyser.php line 33
at StaticAnalyser->fromFile('/var/www/helpa/app/Http/Controllers/UsersController.php') in functions.php line 41
at Swagger\scan('/var/www/helpa/app/Http', array('exclude' => array('/var/www/helpa/storage', '/var/www/helpa/tests', '/var/www/helpa/resources/views', '/var/www/helpa/config', '/var/www/helpa/vendor'))) in routes.php line 39
at SwaggervelServiceProvider->{closure}()
at call_user_func_array(object(Closure), array()) in Route.php line 155
at Route->runCallable(object(Request)) in Route.php line 130
at Route->run(object(Request)) in Router.php line 712
at Router->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Router.php line 714
at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 679
at Router->dispatchToRoute(object(Request)) in Router.php line 639
at Router->dispatch(object(Request)) in Kernel.php line 236
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Kernel.php line 122
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 87
at Kernel->handle(object(Request)) in index.php line 54
at require_once('/var/www/helpa/public/index.php') in server.php line 21
Since the same code works on a different system it must be related to the environment. Any idea what could cause this?
NotFoundHttpException in Application.php line 879:
Cannot find /myAPP/storage/docs/api-docs.json```
Does this branch support 5.2? or I am missing something?
Hi,
Is this package supposed to work with Lumen - specially 5.2?
I don't built APIs in Laravel, only in Lumen, as APIs usually don't need most of Laravel specific stuff - I guess that's what Lumen was built for.
If this package doesn't aim to support Lumen I would appreciate if you could point me to any other package that integrates Swagger with Lumen.
Thanks!
Hi,
There is an "excludes" section in the config file (app.php) that contains absolute path of directories to exclude, while swagger-php itself will convert paths to the canonicalized absolute paths ( See here ).
I'm raising this issue because at the end, we need to implode them using colon delimiter which is causing error in windows.
Command:
php C:\wamp\www\p1/vendor/zircote/swagger-php/swagger.phar C:\wamp\www\p1/app/controllers/api -o C:\wamp\www\p1\app/storage/docs --default-swagger-version '1.2' -e C:\wamp\www\p1\app/storage:C:\wamp\www\p1\app/tests:C:\wamp\www\p1\app/views
Result:
Swagger-PHP 0.9.6
[INFO] Exclude path: "C:\wamp\www\p1\public\C" not found
[INFO] Exclude path: "C:\wamp\www\p1\public\C" not found
[INFO] Exclude path: "C:\wamp\www\p1\public\C" not found
Created C:\wamp\www\p1\app/storage/docs\api-docs.json
Created C:\wamp\www\p1\app/storage/docs\index.php
Created C:\wamp\www\p1\app/storage/docs/pets.json
Hi there,
since the swagger-php update to v2.0 I got the following console notice when trying to add custom request headers through the swaggervel config file:
window.ApiKeyAuthorization is deprecated. Please use SwaggerClient.ApiKeyAuthorization.
Using window.authorizations is deprecated. Please use SwaggerUi.api.clientAuthorizations.add()
The UI loads as usal but if you try to send a request, a javascript error occurs:
TypeError: auth.apply is not a function
I figured that the view file needs to be updated. My solution:
in index.blade.php change Line 67 to:
swaggerApi.clientAuthorizations.add("{!!$requestKey!!}", new SwaggerClient.ApiKeyAuthorization("{!!$requestKey!!}", "{!!$requestValue!!}", "header"));
After this modification everything works just fine.
Would be great if you could implement this in the next revision.
Leonhard
I need add two customizable headers, how do you add this in config file?, without have that writing code in the index.html and make it dynamic and configurable
'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Call to undefined function Swagger\scan()' in /jlapp/swaggervel/src/Jlapp/Swaggervel/routes.php:37
Calling
php artisan swaggervel:install
gives this error:
[RuntimeException]
The "--force" option does not exist.
Is there anything I can do to fix this?
https://github.com/slampenny/Swaggervel/blob/master/src/Jlapp/Swaggervel/routes.php#L24 points to the codepath being hit.
For current Swagger runs via the CLI, it doesn't recreate the output directory at all it just dumps the file. The part of the if statement that passes is the is_writeable($docsDir) which always returns true. This causes the entire directory to be overwritten every generation.
A temporary fix for my deployment issues was to add /storage/docs to the top level .gitignore file but I'd rather it be like all the other storage directories with a self-contained .gitignore file. I'll work on a PR for this shortly.
I am new to Laravel and the installation instructions seem to be lacking proper instructions for someone who is new to the platform. Are you supposed to copy all of the files from the repo into your app root? just adding the line Jlapp\Swaggervel\SwaggervelServiceProvider did not work, I also had to change to Jlapp\Swaggervel\SwaggervelServiceProvider::class
then I copied the jlapp folder into my project app root, and the config files into my config folder and i was able to run php artisan --version without errors. Running php artisan vendor:publish after this does not copy anything to my public_html folder that i can see for swagger. What am I missing? I see a composer.json in the root of the git project do i need to copy that into my apps composer.json as well so it installs when i run composer install ?
Because if my base URL is different then it might be cause problems.
Same problem occur in my project so i solved it via this way.
Thanks
I am uncertain if it is because of the laravel/php package, but its something that comes up as an issue (could be my setup too perhaps) The url for the swagger-ui sits at /api-docs, if you click on an item it adds for instance #!/jenkins-jobs
only this ends up as the url /api-docs#!/jenkins-jobs
which doesnt work correctly when refreshing or direct linking since it should be /api-docs/#!/jenkins-jobs
according to the petstore example.
This error happend right after I type exit and you package must generate the code
[ErrorException]
file_get_contents(/Volumes/Storage/Projects/net-manager_new/vendor/infyomlabs/swagger-generator/templates/model/model.stub): failed to open stream: No such file or directory
Also, in your package folder have only two directories:
core-templates
laravel-generator
there is not a folder called 'swagger-generator'
Hi there,
I've installed the Swaggervel package, run the php artisan commands, but not have my /docs folder created. How could I achieve that?
I've tried to create it manually, on the /app level, then chmod it to 0777. But currently, when I try to call http://myapp.com/docs, I see the next:
How can I solve this?
The docs folder is created on the fly, this data is owned by the www-data user for instance. My code is installed under my own userid and storage folders are 777 for instance. If using artisan commands it should not call the boot command for swagger php since it cant overwrite the files in the docs folder.
Hi,
We have two nginx servers running under load balancer port 443 (https) , when we are trying to browse api-docs and provide docs path for json fetch using VIP DNS name, it is redirecting to port 3043 of VIP DNS, which is not valid. I am not sure why it is changing port from 443 to 3043.
Our Nginx servers are running on port 3043 (https).
Please can some one help on this.
Regards,
Arun
slampenny/swaggervel could not be found in any version
composer require jlapp/swaggervel tried
Also tried :
"require-dev": {
"slampenny/Swaggervel": "~2.0@dev"
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/slampenny/Swaggervel"
}
],
Same issue
Hi,
Multiple API support is needed. Seems swagger does not support multiple API, but we may to generate several different API.
I made a sketch.
https://github.com/Sano000/Swaggervel/blob/extra/src/Jlapp/Swaggervel/routes.php
Here is an updated routes.php file. We take configuration from the standard app.php, but additional api configurations may be added to the extra.php.
https://github.com/Sano000/Swaggervel/blob/extra/src/config/extra.php
For example we have 2 different API in the app/controllers:
We need to exclude app/controllers/api2 path in app.config and do the same with the app/controllers/api in the extra.php. Extra.php may to contain several APIs.
I am not sure, than it is an graceful way, but it works. I could prepare pull request if you are intrested.
I installed swaggervel in my project but when i go to /api-docs i get this error
FatalErrorException in routes.php line 39:
Class 'Swagger\Swagger' not found
in C:\projects\laraveltest\laravel\vendor\jlapp\swaggervel\src\Jlapp\Swaggervel\routes.php line 39
Also i get error when i visit /docs
NotFoundHttpException in C:\projects\laraveltest\laravel\vendor\laravel\framework\src\Illuminate\Foundation\Application.php line 879:
Cannot find C:\projects\laraveltest\laravel\storage/docs/api-docs.json
I'm uncomment viewHeaders
"viewHeaders" => array(
'Token' => 'customTokenHere',
),
This header is add in Response Headers "base_path/api-docs/" but not in Request Headers "base_path" y try add this headers but not found
Hey, I may just not be able to find where, but is there a way to not have the api docs be on public routes but just be generated to a private json file?
"repositories": [
{
"type": "vcs",
"url": "https://github.com/tralves/Swaggervel"
}
],
(...)
"require": {
"jlapp/swaggervel": "master-dev",
}
Should be:
"repositories": [
{
"type": "vcs",
"url": "https://github.com/slampenny/Swaggervel"
}
],
(...)
"require": {
"jlapp/swaggervel": "master-dev",
}
I can try to create a PR but it's so trivial you could get it done much quicker. My hope is at least this issue will illustrate the problem to others in the interim if they start to wonder why things get out of sync.
I'm also a proponent of proper versioning in the much earlier issue. Tags are still very new to me but if you use SourceTree, git flow is built in. Knowing when to tag a new release is a bit of an artform to me but it's always good practice, even with very mundane releases. Git flow can seem like overkill for simple projects but the separation of concerns pays for the pain in implementing it when you move on to something bigger.
Thoughts about upgrading to the new UI / dev branch of php swagger?
When in swagger-ui, you can type in the api_key at top input box. The key isn't removed though if it's cleared. It will only update if there's content in the box, so I can put a space, but then it still sends the auth_token as a space. Only way to get rid of it is to refresh the page.
Hi there,
I really appreciate your work on this package but I do have a suggestion.
Please change Line 21 in the routes.php File to
$appDir = Config::get('swaggervel.app-dir');
Why? Because you often find yourself developing php packages which contain swagger annotations. the swagger-php package can handle an array in this variable per default. And with this modification one can simply use an array of DIRs / files in swaggervel.php config file.
ty Lo3ty
Hi,
With the latest updates, you're using PHP 5.4 array shorthands [], so it's not compatible anymore with PHP 5.3, as stated in packagist. Could you revert to using array() to keep 5.3 compatibility?
Cheers,
Ramon
When I setup my composer.json to use the master-dev branch I get pageNotFound error, if I use the 2.0 branch like the readme says I get Class Swagger/Swagger not found Error.
So far the only way to get the project working is to use the the forked branch https://github.com/tralves/Swaggervel in my composer.json this fork however uses the swagger-ui from the 1.0 spec but then uses the swagger-php from the 2.0 spec so I also had to force composer to use swagger 1.0 with "zircote/swagger-php": "1.0" then go back to 1.0 annotation...
That was my only solution after fighting with this until 4am, but would love to use the 2,0 annotations. I might try just downloading the master branch manually and replacing the files in the public vendor folder manually to see if that updates this tralves fork swagger-ui to 2.0.
UPDATE: copying the public vendor files manually did not work, it gave javascript errors invalid tokens on <! document, and undefined class SwaggerUI even though the script include for swager-ui.js in the header was valid and readable.
Hi,
First of all, I will like you to thank for your efforts in creating this package for the laravel. Now coming to the issue I am facing:
I am working on Windows 8 - xampp environment, using laravel 4.2. All my projects are under the /xampp/htdocs/ folder.
If I am accessing the docs url in one of my project for docs, localhost/test_swaggervel/public/docs
I was getting this error
Jlapp\Swaggervel\SwaggervelServiceProvider::{closure}(): Failed opening required 'C:/xampp/htdocs/docs/index.php' (include_path='C:\xampp\htdocs\apartment\vendor/phpseclib/phpseclib/phpseclib;.;C:\xampp\php\PEAR')
I fixed this by changing the line $path = $_SERVER["DOCUMENT_ROOT"];
to base_path()
in \vendor\jlapp\swaggervel\src\Jlapp\Swaggervel\routes.php
in the route definition for doc, which seems to fixed this issue.
If I am trying to access the url localhost/test_swaggervel/public/api-docs
the page flashes for a second and then i am redirected to http://localhost/api-docs
.
how can i remove OAuth2 settings ui component?.
Hi @slampenny!
I'm currently really need a package like Swaggervel, but I see the last update was in January. Are you missing time to manage issues & PRs?
There are many critical problems mentioned in issues which are almost simple to resolve. May I can open PRs, but how can I be sure that you will merge them? If you need a co-maintainer you can discuss about it ;)
Thanks for your work!
Hello,
It seems that Swaggervel is not compatible with Laravel 5. Whenever I try the command "php artisan swaggervel:install", I get a BadMethodCallException with message 'Call to undefined method [package]'.
Is it possible to update Swaggervel to make it compatible with Laravel 5 please ?
Thanks for your help
Hi one more time,
Could you give me the example of the swagger resource.
How should I describe my resource controller, so it would be parsed with the command line command during the execution ?
How the swagger notation comments should be merged with default phpDoc ?
Below is the example of the controller I want to describe with the help of swagger.
<?php
class QuestsController extends \BaseController {
/**
* Display a listing of the resource.
* GET /quests
*
* @return Response
*/
public function index() {
try {
$result = array('error' => false,
'result' => array('quests' => Quest::all()->toArray()));
} catch (Exception $ex) {
$result = array('error' => true,
'result' => array('messages' => array('exception' => $ex->getMessage())));
}
return self::makeResponseJson($result);
}
}
Maybe a thought to create fixed releases? Using dev-master
in composer.json
is highly discouraged, and our project guidelines don't actually allow it :3
showing the api browser, but when trying to test any of the api paths, the url produced is:
http://myapi.comapi/v1/endpoint when it should be http://myapi.com/api/v1/endpoint
On swagger-ui page i am getting following error-
"This API is using a deprecated version of Swagger! Please see http://github.com/wordnik/swagger-core/wiki for more info"
and swagger-ui page is not displaying any api, even there are 2 resources in swagger.json file.
Can't read from server. It may not have the appropriate access-control-origin settings.
I get this now too, i also noticed you create a index.php file in the docs folder. If i want to "start fresh" and throw that content away the /docs will fail since it wants to find index.php.
In my setup, i have user x, and web is user www-data for instance. Files in that folder in my case should be owned by www-data and 777 on the docs folder for example. This worked fine before, but it doesnt generate them on the fly anymore too. (keeps refreshing after above error message in an alarming rate too)
[2014-07-29 11:12:24] production.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Jlapp\Swaggervel\SwaggervelServiceProvider::{closure}(): Failed opening required '/home/toolbox/public_html/public/../docs/index.php' (include_path='/home/toolbox/public_html/vendor/phpseclib/phpseclib/phpseclib:.:/usr/share/php:/usr/share/pear')' in /home/toolbox/public_html/vendor/jlapp/swaggervel/src/Jlapp/Swaggervel/routes.php:12
is what you get without index.php.
I tried adding the origin to the index.php too, but that didn't help. If you need more logs/whatever then let me know.
When I try to fetch the response for a particular URL, the swagger-ui shows nothing. When I see in networks, there is a request for that api and response is OK. Although, there is nothing on the screen. When I check console log, I see this error:
"This API is using a deprecated version of Swagger! Please see http://github.com/wordnik/swagger-core/wiki for more info"
What exactly am I missing out on it??
Hi,
I'm using Lumen and wanted to add Swaggervel to the application. If this doesn't work, just tell me. If it should work, here is what my problem is.
I added swaggervel to my dependencies
"jlapp/swaggervel" : "2.0.*@dev"
As you can see, the files are in my vendor folder
In Lumen you add Service Providers in the /PROJECTDIR/bootstrap/app.php
instead of in the app/config/app.php
Now, I wanted to run php artisan vendor:publish
. When I do this I'm getting the following message:
Class 'Route' not found in /PROJECTDIR/vendor/jlapp/swaggervel/src/Jlapp/Swaggervel/routes.php on line 5
Complete stacktrace
PHP Stack trace:
PHP 1. {main}() /PROJECTDIR/artisan:0
PHP 2. require() /PROJECTDIR/artisan:18
PHP 3. Laravel\Lumen\Application->register() /PROJECTDIR/bootstrap/app.php:81
PHP 4. Jlapp\Swaggervel\SwaggervelServiceProvider->register() /PROJECTDIR/vendor/laravel/lumen-framework/src/Application.php:229
PHP 5. require_once() /PROJECTDIR/vendor/jlapp/swaggervel/src/Jlapp/Swaggervel/SwaggervelServiceProvider.php:46`
Any idea why this doesn't work or what I did wrong?
At the bottom of my providers
array I have:
'Dingo\Api\Provider\ApiServiceProvider',
'Jlapp\Swaggervel\SwaggervelServiceProvider',
I get a Call to undefined method Illuminate\Routing\Router::api()
error when I try to load a page. If I delete the Swaggervel provider, the error goes away.
After running composer update on my project. I'm now getting errors saying the annotations are deprecated. After some digging I found out that zircote/swagger-php master branch (which I assume swaggervel uses) is now using an update annotation system. To utilize the annotations older annotations you're required to use branch 1.x. I'd prefer not to rewrite all my swagger documentation.
I've got this package working great with the doc blocks but I'd like to move my documentation out of my controllers into associated .yaml files. I believe this is supported by Swagger 2.0, is there a way to make the swagervel scan pick them up?
Hi,
I found an issue after I noticed that my responseModels aren't filled anymore.
Models are ignored if they're not used in a resource. If you put the controllers and models in two different swagger.phar requests, like in your example config, models won't be parsed. I think it's better to just have one target-dir.
When trying to install Swaggervel to Laravel 5.2 as described in readme.md,
App\Providers\EventServiceProvider::class, 'Jlapp\Swaggervel\SwaggervelServiceProvider', App\Providers\RouteServiceProvider::class,
after
"php artisan vendor:publish"
I get:
PHP Fatal error: Class 'Jlapp\Swaggervel\SwaggervelServiceProvider' not found in ***/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php on line 146 [Symfony\Component\Debug\Exception\FatalErrorException] Class 'Jlapp\Swaggervel\SwaggervelServiceProvider' not found
Hi!
Illuminate\Html\HtmlServiceProvider is needed for api-docs and the install guide does not mention it. Maybe HTML::style should be Html::style in the index.blade.php because of the Laravel default class name convention.
I found some description about the problem:
http://slick.pl/kb/laravel/classes-form-and-html-not-found-in-laravel-5/
Cheers!
When i go to /docs it only works if i make a folder in my public folder (then i get a redirect loop). If i go to api-docs it does show me something only all the links in there are with capitals in the urls too.
Example: HTML::script('packages/Jlapp/Swaggervel/lib/shred.bundle.js'); }}
Capital J, capital S. while the php artisan swaggervel:install pushes it in, and those files are all lower case..
p.s. {{ HTML::style('https://fonts.googleapis.com/css?family=Droid+Sans:400,700'); }}
Dont rely on outside sources, since not everyone uses apps on the internet.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.