Update Swagger doc for Auth (2)
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 Auth. You should update the documentation according to the pattern below:
@ApiBearerAuth()
@ApiOkResponse({
type: DisciplineTeachersResponse,
})
@ApiBadRequestResponse({
description: `\n
InvalidQueryException:
Type of discipline must be a field of enum
InvalidDisciplineIdException:
Discipline with such id is not found`,
})
@ApiUnauthorizedResponse({
description: `\n
UnauthorizedException:
Unauthorized`,
})
@ApiForbiddenResponse({
description: `\n
NoPermissionException:
You do not have permission to perform this action`,
})
@ApiParam({
name: 'disciplineId',
required: true,
description: 'Id of certain discipline',
})
@ApiQuery({
name: 'disciplineType',
required: true,
enum: DisciplineTypeEnum,
description: 'Discipline type of some discipline',
})
@Access(PERMISSION.GROUPS_$GROUPID_DISCIPLINES_TEACHERS_GET, GroupByDisciplineGuard)
@Get('/:disciplineId/teachers')
async getAllByDiscipline (
@Param('disciplineId', DisciplineByIdPipe) disciplineId: string,
@Query('disciplineType') disciplineType: DisciplineTypeEnum
) {
const teachers = await this.disciplineService.getTeachers(disciplineId, disciplineType);
return { teachers };
}
Structure:
- auth (if needed)
- ok response
- client errors
- params/query description
- access (if needed)
You should also add field description in the bady or response.
Add summary to endpoints (fix this issue).
Set default values for the optional fields
My DM is always open for you. Happy coding 🐸