mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 12:32:43 +00:00
fix(openapi): declare the mirror replay 200 of a medication create
A mirror create re-posting a pair the caller already holds has always answered the existing medication with 200, as the description says; only the 201 was declared.
This commit is contained in:
1 parent
55a6287069
commit
521b85bfbd
2 files changed
+22
-6
No files matched your search
@@ -6585,6 +6585,13 @@ paths:
|
||||
schema:
|
||||
$ref: "#/components/schemas/CreateMedicationRequest"
|
||||
responses:
|
||||
"200":
|
||||
description: "A mirror create re-posting an `(externalSource, externalId)` pair the caller already holds: the existing
|
||||
medication, nothing written."
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/CreateMedicationResponse"
|
||||
"201":
|
||||
description: Created medication with its schedules.
|
||||
content:
|
||||
|
||||
@@ -255,6 +255,13 @@ const medicationIntakeImportJobStatusEnvelope = dataEnvelope(
|
||||
"MedicationIntakeImportJobStatusEnvelope",
|
||||
);
|
||||
|
||||
// Shared by the create's 201 and its mirror-replay 200: the envelope id is
|
||||
// registered once.
|
||||
const createMedicationResponse = dataEnvelope(
|
||||
medicationDetailEntry,
|
||||
"CreateMedicationResponse",
|
||||
);
|
||||
|
||||
export const medicationPaths: NonNullable<ZodOpenApiObject["paths"]> = {
|
||||
"/api/medications/intake": {
|
||||
get: {
|
||||
@@ -969,12 +976,14 @@ export const medicationPaths: NonNullable<ZodOpenApiObject["paths"]> = {
|
||||
"201": {
|
||||
description: "Created medication with its schedules.",
|
||||
content: {
|
||||
"application/json": {
|
||||
schema: dataEnvelope(
|
||||
medicationDetailEntry,
|
||||
"CreateMedicationResponse",
|
||||
),
|
||||
},
|
||||
"application/json": { schema: createMedicationResponse },
|
||||
},
|
||||
},
|
||||
"200": {
|
||||
description:
|
||||
"A mirror create re-posting an `(externalSource, externalId)` pair the caller already holds: the existing medication, nothing written.",
|
||||
content: {
|
||||
"application/json": { schema: createMedicationResponse },
|
||||
},
|
||||
},
|
||||
...stdResponses,
|
||||
|
||||
Reference in new issue
Block a user