Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] @bodyParamsFile, to generate Body Parameters documentation from json file #767

Open
ajcastro opened this issue Jun 29, 2020 · 1 comment

Comments

@ajcastro
Copy link

ajcastro commented Jun 29, 2020

Allow to generate Body Parameters documentation from a json file.
Example:

/**
 * Store user
 *
 * @bodyParamsFile requests/users.store.json
 * 
 * @responseFile responses/users.store.json
 */

I would like to share my workflow.

  1. I have helpers createJsonRequestFile() and createJsonResponseFile() that will write my json files in storage/requests and storage/responses folders.
    Example:
public function test_users_store()
{
    $response = $this->postJson(route('users.store'), $data = []);

    $response
    ->createJsonRequestFile()
    ->createJsonResponseFile()
    ->assertCreated();
}
  1. Then I run phpunit and apidoc:generate to generate my api docs:
phpunit && php artisan apidoc:generate

As you can see I create my json data from unit tests and currently we have @responseFile for responses that's why I would also like to suggest feature like @bodyParamsFile for body params.

Also, maybe we can also do this for @queryParamsFile and @urlParamsFile.

@Chris-Pratt-Clystnet
Copy link

I have just run into this myself as I have a request that has a large number of body params.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants