/**
* @response {
* data: [],
*}
*/
What I have to do to make it work ? 1.7.0
For me neither.
I also had the same issue
1.7.0 with Laravel 5.3
also typical docblock tags like for example @param and @return are not show up
I have the same problem in Laravel 5.4 and mpociot 2.0 !!!
I've been looking at the code and from what I can tell, @response doc tags are only available for the latest development version (meaning that if you are using the tagged 2.0 version then you are not getting it; you need to use the master branch).
It also seems that the Dingo generator does not have the feature enabled (only LaravelGenerator has had it's code changed with the @response and @transformer tags in the master branch)
Version 1.7.0 obviously does not get @response tag support, and it most likely will not. I'm currently working on a 1.7 fork (since I am stuck with Laravel 5.2 and cannot upgrade to 5.4 at this time) that will enable this feature, and once I get something working I'll see if @mpociot will merge it as potentially 1.7.1 (depends on his willingness to support older releases)
@almightynassar thanks. You saved me hours. I updated my composer.json to use the master branch
composer require mpociot/laravel-apidoc-generator:dev-master
Using dev-master with laravel 5.5 and am not seeing the response output.
Doesn't work with me neither
dev-master 2d4cf80
Laravel Framework 5.5.4
/**
* Save admin
* @response {
* data: ["123":"123"],
*}
*/
public function store(PitzAdminRequest $request)
{
return null;
}
ze@desktop:~/projects/xproject$ php artisan api:generate --routePrefix=api/admin/* --output=storage/app/public/apiadmin --header 'Authorization:Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjgwMDAvYXBpL2FkbWluL2xvZ2luIiwiaWF0IjoxNTA5NjE4MTM3LCJleHAiOjE1MDk2MjE3MzcsIm5iZiI6MTUwOTYxODEzNywianRpIjoicnU4cTVuU0RUMFgxdUg4YyIsInN1YiI6MSwicHJ2IjoiNDE2ZDRkMzZiNjgxNmJlZGRmMzQ2MDBlNmZlOGIwYWZiNGVjNDA3NiJ9.InKMHi8I5fojDOoSJg8Xu_VjppMWcAChvrczWxPOZ_A' --force
It should work now
I did the steps said by @filtration, now I can see the response but its not well formatted
"{\n data: [\"123\":\"123\"],\n}"
Same here.
I fix it by use command to replace characters:
namespace App\Console\Commands;
use Illuminate\Console\Command;
class GenerateApiDoc extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'api:docs {version}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Generate API documents';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$version = $this->argument('version');
$this->call('api:generate', ['--routePrefix' => "{$version}/*", '--force' => 'true']);
$file = __DIR__ . '/../../../public/docs/index.html';
if (file_exists($file)) {
$html = file_get_contents($file);
$html = str_replace('\n', '<br>', $html);
$html = str_replace('"{', '{', $html);
$html = str_replace('}"', '}', $html);
$html = str_replace('\"', '"', $html);
file_put_contents($file, $html);
}
}
}
Result:

Response not coming in Laravel 5.5,Please suggest me,how can i do this
@vikkudit5 make sure you are using "mpociot/laravel-apidoc-generator": "dev-master"
/**
*
* # Login
*
* Get authentication credentials
*
*
* @response {
* data : [
* 'access_token' => '$2y$10$PGbWHlE8E1Svz1vENGiN4ef4kiaa9VQxLHC/p.T22mbCZqTQ1IldG',
* 'token_type' => 'bearer',
* 'expires_in' => 3600
* ]
* }
*/
Doesn't work for me either with dev-master. Does anyone have an idea?
This is what I did.
composer require mpociot/laravel-apidoc-generator:dev-masterphp artisan api:generate --routePrefix='api/v1/*'At this point the @response tag was showing up, but not correctly formatted.
Creating a command and using the code from @uocgansoi worked and the example response is now present and correctly formatted.
Hope this helps.
Hey @Punksolid your issue has been fixed in #271. Going to tag a new release soon.
Most helpful comment
I've been looking at the code and from what I can tell, @response doc tags are only available for the latest development version (meaning that if you are using the tagged 2.0 version then you are not getting it; you need to use the master branch).
It also seems that the Dingo generator does not have the feature enabled (only LaravelGenerator has had it's code changed with the @response and @transformer tags in the master branch)
Version 1.7.0 obviously does not get @response tag support, and it most likely will not. I'm currently working on a 1.7 fork (since I am stuck with Laravel 5.2 and cannot upgrade to 5.4 at this time) that will enable this feature, and once I get something working I'll see if @mpociot will merge it as potentially 1.7.1 (depends on his willingness to support older releases)