From bdfff049750505af89dc4ce96a135a6d4029fbb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Wed, 9 Sep 2026 22:45:17 +0200 Subject: [PATCH] docs(api): say what the batch ingest does with a sample's unit The field carried no description while the server ignored it. It no longer ignores it, so the contract has to say so. Refs #944 --- docs/api/openapi.yaml | 3 +++ src/lib/openapi/routes/measurements.ts | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/api/openapi.yaml b/docs/api/openapi.yaml index 72915fbc3..4e2fbce92 100644 --- a/docs/api/openapi.yaml +++ b/docs/api/openapi.yaml @@ -21350,6 +21350,9 @@ components: type: string minLength: 1 maxLength: 60 + description: Apple's `HKUnit` string for `value`. The server converts the reading into the unit it stores the identifier + in when the two differ and the factor is known (`km` to `m`, `lb` to `kg`, `degF` to `degC`, and their + siblings); a unit the server cannot place leaves the reading untouched. startDate: type: string format: date-time diff --git a/src/lib/openapi/routes/measurements.ts b/src/lib/openapi/routes/measurements.ts index ff655f406..756618059 100644 --- a/src/lib/openapi/routes/measurements.ts +++ b/src/lib/openapi/routes/measurements.ts @@ -53,7 +53,13 @@ const batchEntrySchema = z .describe( "v1.19.2 (iOS #34 extension) — the bucket's MAXIMUM bpm for a 10-minute heart-rate bucket (see `externalId`). Persisted ONLY on a well-formed `stats:HKQuantityTypeIdentifierHeartRate:` row; ignored (stored null) on every other entry. Omit on a pre-v1.19.2 client — the bucket keeps the avg-only contract.", ), - unit: z.string().min(1).max(60), + unit: z + .string() + .min(1) + .max(60) + .describe( + "Apple's `HKUnit` string for `value`. The server converts the reading into the unit it stores the identifier in when the two differ and the factor is known (`km` to `m`, `lb` to `kg`, `degF` to `degC`, and their siblings); a unit the server cannot place leaves the reading untouched.", + ), startDate: z.iso.datetime({ offset: true }), endDate: z.iso.datetime({ offset: true }), sleepStage: z