-
Notifications
You must be signed in to change notification settings - Fork 8
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
Create Swagger descriptions for volunteer api #185
base: development
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Очень хорошо, но 400 надо бы детальнее обругать :))
@ApiCreatedResponse({ type: Promise<Task[]> }) | ||
@ApiUnauthorizedResponse({ description: 'Требуется авторизация' }) | ||
@ApiForbiddenResponse({ description: 'Требуется другой статус или роль' }) | ||
@ApiBadRequestResponse({ description: 'Произошла ошибка' }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А точно просто "ошибка"? Или есть конкретный косяк в запросе?
@ApiCreatedResponse({ type: Promise<Task> }) | ||
@ApiUnauthorizedResponse({ description: 'Требуется авторизация' }) | ||
@ApiForbiddenResponse({ description: 'Требуется другой статус или роль' }) | ||
@ApiBadRequestResponse({ description: 'Произошла ошибка' }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Аналогично предыдущему.
@ApiOperation({ summary: 'Получение новых задач по статусу' }) | ||
@ApiQuery({ type: GetTasksSearchDto }) | ||
@ApiCreatedResponse({ type: Promise<Task[]> }) | ||
@ApiUnauthorizedResponse({ description: 'Требуется авторизация' }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Нужно не только сделать описание, но и показать пример ответа, т.е. при ошибке у нас выбросится объект вида...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Сейчас слияние заблокировано: надо подтянуть последние изменения из development
и решить все конфликты.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Рома, надо нормально описать ошибку 400.
Например, на ручке PUT /recipient/tasks/:id/accept
ошибка 400 возникнет, если :id
не пройдёт валидацию, на ручке GET /volunteer/tasks/accepted' - если не отвалидируется search query (описанное
GetTasksSearchDto`).
Именно это и надо указать в описании ошибки в Swagger.
} | ||
}) | ||
@ApiBadRequestResponse({ | ||
description: 'Ошибка запроса. В нём есть пользователь?', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Нет, надо внятно объяснить в чём проблема. В каких случаях летит 400? Проанализируй код контроллера и dto, и распиши, какие возможны ошибки.
} | ||
}) | ||
@ApiBadRequestResponse({ | ||
description: 'Ошибка запроса. В нём есть пользователь?', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Аналогично.
} | ||
} | ||
}) | ||
@ApiBadRequestResponse({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Аналогично
} | ||
}) | ||
@ApiBadRequestResponse({ | ||
description: 'Ошибка запроса. В нём есть пользователь?', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Аналогично.
} | ||
}) | ||
@ApiBadRequestResponse({ | ||
description: 'Ошибка запроса. В нём есть пользователь?', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Аналогично.
No description provided.