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

Allow use of @apiUse in @apiSuccessExmample & @apiErrorExample #1433

Open
IVoyt opened this issue Oct 6, 2023 · 1 comment
Open

Allow use of @apiUse in @apiSuccessExmample & @apiErrorExample #1433

IVoyt opened this issue Oct 6, 2023 · 1 comment

Comments

@IVoyt
Copy link

IVoyt commented Oct 6, 2023

Feature request

Please add possibility to specify @APIuse as body of @apiSuccessEample and @apiErrorExample section to make api documenting more flexible

Why this is needed.

For example we have multiple endpoints with same response body but different response codes.
The following would allow to get rid of duplication

Currently we have write as follows

/**
 * @api {get} /some-route
 * @apiGroup Some Group
 * 
 * @apiSuccessExample {json} Response-Example:
 * HTTP/1.1 200 OK
 * {
 *     "data": {
 *       // data body
 *     }
 * }
 */

/**
 * @api {post} /some-route
 * @apiGroup Some Group
 * 
 * @apiSuccessExample {json} Response-Example:
 * HTTP/1.1 201 Created
 * {
 *     "data": {
 *       // data body
 *     }
 * }
 */

My proposal is to allow write as follows

/**
 * @api {get} /some-route
 * @apiGroup Some Group
 * 
 * @apiSuccessExample {json} Response-Example:
 * HTTP/1.1 200 OK
 * @apiUse responseExample
 */

/**
 * @api {get} /some-route
 * @apiGroup Some Group
 * 
 * @apiSuccessExample {json} Response-Example:
 * HTTP/1.1 201 Created
 * @apiUse responseExample
 */

/**
 * @apiDefine responseExample
 *
 * {
 *     "data": {
 *       // data body
 *     }
 * }
 *
@NicolasCARPi
Copy link
Collaborator

Hello,

Please take into account that there is nobody available to maintain this library. See #1436.

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