How to add Models to API Blueprint documentation?
- Dominant language
- PHP
- Stars
- 9.4k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Description
In most cases my application does return a database/eloquent model in json form as a response.
Is there any way to use the model/class itself in the documentation to automatically derive the corresponding attributes from the model?
Currently I am always copy/pasting the same pre-written json string, which is quite a nuisance in case the model changes and I have to edit all of the string manually.
/**
* Healthcheck
*
* Return http code 200 if the api is reachable.
*
* @Get("/health/")
* @Versions({"v1"})
* @Request({"id": "1"})
* @Response(200, body={"message": "Application is up", "status": "StatusModel.php"})
*
* @return JsonResponse
*/
public function getHealth()
{
return new JsonResponse(['message' => Application is up', 'status' => new Status()]);
}
Contributor guide
Assessment
This issue has not been assessed yet.