Did you read https://github.com/dingo/api/wiki/API-Blueprint-Documentation ? Is something that did not work for you?
php artisan api:docs --output-file api.md
@catalinux I have read this documentation but not getting idea, How it's look and fill on browser. If you having any reference please let me know.
@wanglv for php artisan api:docs --output-file api.md what's happen. Can you please provide step by step flow of code ?
When you run `php artisan api:docs --output-file api.md --name 'Doc' in your directory a file called api.md will be generated.
.md extenstion states for markdown format.
The command will gather all annotations that you filled in on your controllers (see https://github.com/dingo/api/wiki/API-Blueprint-Documentation) and put them in nice format, something like that
FORMAT: 1A
# Doc
# Contact [/contact]
## Create a contact [POST /contact]
+ Request (application/json)
+ Headers
X-Custom: FooBar
+ Body
{
"last_name": "foo",
"first_name": "bar"
}
## Show all contacts [GET /contact]
Get a JSON representation of all the registered users.
@catalinux thank you for reply. Can you please share how it's look in browser in term of UI. Thanks,
@tankhit Hard to do that, since there are many options available for turning the API Blueprint markdown file to browse-able documentation. One example of this is https://apiary.io/.
Hi, i tried generating docs with the following command :
$ php artisan api:docs --name Developer --use-version v1 --output-file ApiDocs.md
Output : Documentation was generated successfully
But the ouput of the file is only with the title without my comments parameters etc... in controllers. It does not ouput any information in the doc file. Thanks in advance
+1 for @petyots
I had the same problem and just switched to swagger. But it would be better if someone fix this issue or at least try to figure out what's wrong.
@petyots @hlogeon same problem
the output file contain only title without any description
I was using v1 instead of V1 which was in my project file that was the error ;)
@hlogeon please add annotation for Controller and also for Controller method. Hope will solve your problem.
For Example,
/*
* @Resource("Test")
*/
class TestController
{
/*
* Create the Test
*
* @Post("/")
*
* @Versions({"v1"})
* @Request({"first_name": "Test", "last_name": "Test2"},headers={"X-Custom": "Test Header"}))
* @Response(200, body={"id": 10, "username": "Test3"})
*/
public function Test()
{
}
}
Few years after I found the issue, for future reference, documentation results empty because dingo/blueprint is missing, add it to your composer.json:
"dingo/blueprint": "^0.2.4",
It's there by default (now anyway).
Going to close this issue as it seems really old and potentially no longer relevant
Most helpful comment
+1 for @petyots
I had the same problem and just switched to swagger. But it would be better if someone fix this issue or at least try to figure out what's wrong.