Laravel-apidoc-generator: How to add documentation about file upload.

Created on 15 Apr 2020  路  9Comments  路  Source: mpociot/laravel-apidoc-generator

I have an endpoint where I have to send a query parameter with a file.

How do I document this? I cant find any example about a file upload.

Thanks in advance

next

Most helpful comment

All 9 comments

I'm need this too...
I think they're not support yet by default.

only manual editing index.md for custom header and request sample.
Link: https://laravel-apidoc-generator.readthedocs.io/en/latest/generating-documentation.html#manually-modifying-the-content-of-the-generated-documentation

Yes I know you can change the index.md.

After that you cant do much in that endpoint, because when generating the docs that endpoint will be skipped.

That also means, that you have to do your own Request examples aswell. I found that the cURL, PHP Guzzle and Javascript wont match anymore. They are just wrong.

yes, same issue with me.

for now, i'm just make separate documentation for using upload api and delete all comment api docs in route upload file.

There isn't support for documenting file uploads, but we can consider it. What exactly would you like to see and any suggestions on implementation?

Hello @shalvah ,

I already posted some of the things I think is really helpfull in on another issue, where you talk about the next major release.

It would be a great help if we dont have to change anything manually when there is a file upload.

I just dont like that a manual change is enough for that endpoint to be skipped when you want to generate the docs. Maybe a new artisan command would help. Something like "php artisan apidoc:rewrite" or something like that.

Thanks

Hi @shalvah,

maybe added @fileParam rather than using @bodyParam.
When @fileParam use, then header change to Content-Type: multipart/form-data and with file upload example.

or

Extend @bodyParam for support file type.

is this what I am thinking right now or if anyone has any other ideas?

Thanks

I also like @JuniYadi idea.

You can use --force if you want it to overwrite your changes, btw.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

arikardnoir picture arikardnoir  路  8Comments

Herchelle picture Herchelle  路  8Comments

herpaderpaldent picture herpaderpaldent  路  7Comments

yakabay picture yakabay  路  3Comments

nikosv picture nikosv  路  3Comments