dingo / dingo/api

How to add Models to API Blueprint documentation?

Open
#1,409 0 comments 1 reaction 0 assignees View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.