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:
Marc-André Bombeck committed 2026-10-23 17:10:02 +02:00
1 parent 55a6287069
commit 521b85bfbd
2 files changed
+22 -6

No files matched your search

+7
View File
@@ -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:
+15 -6
View File
@@ -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,