From 521b85bfbdc6ebed8a135c6d6dc7e284ad295868 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Fri, 23 Oct 2026 17:10:02 +0200 Subject: [PATCH] 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. --- docs/api/openapi.yaml | 7 +++++++ src/lib/openapi/routes/medications/paths.ts | 21 +++++++++++++++------ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/docs/api/openapi.yaml b/docs/api/openapi.yaml index 3933181fb..ee9bd53e2 100644 --- a/docs/api/openapi.yaml +++ b/docs/api/openapi.yaml @@ -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: diff --git a/src/lib/openapi/routes/medications/paths.ts b/src/lib/openapi/routes/medications/paths.ts index 8ebdf52e0..d5ef6928f 100644 --- a/src/lib/openapi/routes/medications/paths.ts +++ b/src/lib/openapi/routes/medications/paths.ts @@ -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 = { "/api/medications/intake": { get: { @@ -969,12 +976,14 @@ export const medicationPaths: NonNullable = { "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,