1
0
Fork 0

refactor(api): replace Error schema with ProblemDetails (RFC 7807)

This commit is contained in:
Vojtěch Mareš 2024-04-27 21:15:49 +02:00
parent d1c6eb0069
commit 32038981f6
Signed by: vojtech.mares
GPG key ID: C6827B976F17240D

View file

@ -36,7 +36,7 @@ paths:
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
$ref: "#/components/schemas/ProblemDetails"
post:
summary: Create a new training
operationId: createTraining
@ -60,13 +60,13 @@ paths:
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
$ref: "#/components/schemas/ProblemDetails"
default:
description: Unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
$ref: "#/components/schemas/ProblemDetails"
/trainings/{trainingID}:
get:
summary: Get a training by ID
@ -95,13 +95,13 @@ paths:
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
$ref: "#/components/schemas/ProblemDetails"
default:
description: Unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
$ref: "#/components/schemas/ProblemDetails"
put:
summary: Update a training by ID
operationId: updateTraining
@ -135,19 +135,19 @@ paths:
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
$ref: "#/components/schemas/ProblemDetails"
"400":
description: Invalid input
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
$ref: "#/components/schemas/ProblemDetails"
default:
description: Unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
$ref: "#/components/schemas/ProblemDetails"
delete:
summary: Delete a training by ID
@ -172,13 +172,13 @@ paths:
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
$ref: "#/components/schemas/ProblemDetails"
default:
description: Unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
$ref: "#/components/schemas/ProblemDetails"
/trainings/{trainingID}/dates:
get:
@ -210,7 +210,7 @@ paths:
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
$ref: "#/components/schemas/ProblemDetails"
post:
summary: Create a new date for a training
@ -245,13 +245,13 @@ paths:
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
$ref: "#/components/schemas/ProblemDetails"
default:
description: Unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
$ref: "#/components/schemas/ProblemDetails"
/trainings/{trainingID}/dates/{dateID}:
delete:
@ -286,13 +286,13 @@ paths:
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
$ref: "#/components/schemas/ProblemDetails"
default:
description: Unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
$ref: "#/components/schemas/ProblemDetails"
put:
summary: Update a date of a training
operationId: updateTrainingDate
@ -335,19 +335,19 @@ paths:
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
$ref: "#/components/schemas/ProblemDetails"
"400":
description: Invalid input
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
$ref: "#/components/schemas/ProblemDetails"
default:
description: Unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
$ref: "#/components/schemas/ProblemDetails"
/trainings/{trainingID}/dates/{dateID}/attendees:
get:
@ -388,7 +388,7 @@ paths:
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
$ref: "#/components/schemas/ProblemDetails"
post:
summary: Add an attendee to a date of a training
@ -426,13 +426,13 @@ paths:
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
$ref: "#/components/schemas/ProblemDetails"
default:
description: Unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
$ref: "#/components/schemas/ProblemDetails"
/trainings/{trainingID}/dates/{dateID}/attendees/{attendeeID}:
delete:
@ -476,13 +476,13 @@ paths:
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
$ref: "#/components/schemas/ProblemDetails"
default:
description: Unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
$ref: "#/components/schemas/ProblemDetails"
/trainings/{trainingID}/dates/{dateID}/attendees/{attendeeID}/feedback:
post:
@ -536,13 +536,13 @@ paths:
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
$ref: "#/components/schemas/ProblemDetails"
default:
description: Unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
$ref: "#/components/schemas/ProblemDetails"
/trainings/{trainingID}/dates/{dateID}/feedback:
get:
@ -583,7 +583,7 @@ paths:
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
$ref: "#/components/schemas/ProblemDetails"
/trainings/{trainingID}/feedback:
get:
@ -615,7 +615,7 @@ paths:
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
$ref: "#/components/schemas/ProblemDetails"
/trainings/upcoming-dates:
get:
@ -662,7 +662,7 @@ paths:
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
$ref: "#/components/schemas/ProblemDetails"
components:
schemas:
NewTraining:
@ -812,13 +812,30 @@ components:
format: float
minimum: 0
Error:
ProblemDetails:
type: object
description: >
Schema that carries the details of an error in an HTTP response.
See https://datatracker.ietf.org/doc/html/rfc7807 for more information.
properties:
code:
type:
type: string
message:
description: A URI reference that identifies the problem type.
title:
type: string
description: A human-readable summary of the problem type.
status:
type: integer
description: The HTTP status code generated by the origin server for this occurrence of the problem.
detail:
type: string
description: A human-readable explanation specific to this occurrence of the problem.
instance:
type: string
description: A URI reference that identifies the specific occurrence of the problem.
required:
- code
- message
- type
- title
- status
- detail
- instance