feat(api): restore ping endpoint and add rate limit responses
Restores the /ping endpoint for health checks and adds 429 Too Many Requests response handling to improve API robustness.
This commit is contained in:
parent
a93fde3a3c
commit
caa4bb0919
3 changed files with 27 additions and 17 deletions
|
|
@ -26,22 +26,6 @@ tags:
|
|||
description: Gestion et consultation du référentiel RH des employés.
|
||||
|
||||
paths:
|
||||
/ping:
|
||||
get:
|
||||
tags:
|
||||
- System
|
||||
summary: Health check (Ping)
|
||||
description: Permet de vérifier que l'API est fonctionnelle.
|
||||
operationId: ping
|
||||
responses:
|
||||
'200':
|
||||
description: Service OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: string
|
||||
example: "pong"
|
||||
|
||||
|
||||
/employees:
|
||||
get:
|
||||
|
|
@ -79,6 +63,8 @@ paths:
|
|||
$ref: '#/components/responses/Forbidden'
|
||||
'422':
|
||||
$ref: '#/components/responses/UnprocessableEntity'
|
||||
'429':
|
||||
$ref: '#/components/responses/TooManyRequests'
|
||||
'500':
|
||||
$ref: '#/components/responses/InternalServerError'
|
||||
'503':
|
||||
|
|
@ -111,6 +97,8 @@ paths:
|
|||
$ref: '#/components/responses/NotFound'
|
||||
'422':
|
||||
$ref: '#/components/responses/UnprocessableEntity'
|
||||
'429':
|
||||
$ref: '#/components/responses/TooManyRequests'
|
||||
'500':
|
||||
$ref: '#/components/responses/InternalServerError'
|
||||
'503':
|
||||
|
|
@ -295,6 +283,26 @@ components:
|
|||
schema:
|
||||
$ref: '#/components/schemas/ValidationErrorProblemDetails'
|
||||
|
||||
TooManyRequests:
|
||||
description: Trop de requêtes envoyées dans un laps de temps donné (429 Too Many Requests).
|
||||
content:
|
||||
application/problem+json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ProblemDetails'
|
||||
headers:
|
||||
Retry-After:
|
||||
description: Le nombre de secondes avant de pouvoir réessayer.
|
||||
schema:
|
||||
type: integer
|
||||
X-RateLimit-Limit:
|
||||
description: La limite de requêtes par minute.
|
||||
schema:
|
||||
type: integer
|
||||
X-RateLimit-Remaining:
|
||||
description: Le nombre de requêtes restantes avant blocage.
|
||||
schema:
|
||||
type: integer
|
||||
|
||||
InternalServerError:
|
||||
description: Erreur interne du serveur (500 Internal Server Error).
|
||||
content:
|
||||
|
|
|
|||
|
|
@ -16,6 +16,9 @@ Route::get(
|
|||
])
|
||||
)->name('api.root');
|
||||
|
||||
Route::get('/ping', fn () => response()->json('pong'))->name('api.ping');
|
||||
|
||||
|
||||
// * V1 API
|
||||
Route::prefix('v1')->name('api.v1.')->group(function () {
|
||||
require __DIR__ . '/apiv1.php';
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ Route::get('/', fn () => response()->json([
|
|||
'spec' => route('api.v1.openapi'),
|
||||
]))->name('root');
|
||||
|
||||
Route::get('/ping', fn () => response()->json('pong'))->name('ping');
|
||||
|
||||
Route::get('/openapi', function () {
|
||||
return response()->file(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue