Update Swagger doc for Group (1)
Closed this issue · 0 comments
fokaaas commented
We are updating the documentation for all endpoints and adding more description and details.
One of the main controllers is Group. You should update the documentation according to the pattern below:
@ApiBearerAuth()
@ApiOkResponse()
@ApiBadRequestResponse({
description: `\n
InvalidEntityIdException:
User with such id is not found
AlreadyRegisteredException:
User is already registered
InvalidBodyException:
Group id can not be empty
IsCaptain must be a boolean
IsCaptain can not be empty
AbsenceOfCaptainException:
Captain was not found
AbsenceOfCaptainTelegramException:
Captain's telegramId was not found`,
})
@ApiUnauthorizedResponse({
description: `\n
UnauthorizedException:
Unauthorized`,
})
@ApiForbiddenResponse({
description: `\n
NoPermissionException:
You do not have permission to perform this action
ForbiddenException:
Forbidden`,
})
@ApiParam({
name: 'userId',
required: true,
description: 'Id of a user to request to the group',
})
@ApiEndpoint({
summary: 'Request captain or admin to join the group',
permissions: PERMISSION.USERS_$USERID_GROUP_REQUEST,
})
@Patch('/:userId/requestNewGroup')
requestNewGroup (
@Param('userId', UserByIdPipe) userId: string,
@Body() body: GroupRequestDTO,
) {
return this.userService.requestNewGroup(userId, body);
}
Structure:
- auth (if needed)
- ok response
- client errors
- params/query description
- api endpoint for summary, permissions, guards
You should also add field description in the body or response.
Add summary to endpoints (fix this issue).
Set default values for the optional fields
Example: #777
My DM is always open for you. Happy coding 🐸