fix(openapi): admit the bare-instant route samples older tracks carry

A track stored before the object form holds one ISO instant per point, and the detail answers it as stored. The route-sample declaration accepts both forms.
This commit is contained in:
Marc-André Bombeck committed 2026-10-23 14:00:05 +02:00
1 parent 32dec72564
commit 38baafcdd7
2 files changed
+28 -21

No files matched your search

+9 -6
View File
@@ -187,15 +187,18 @@ const workoutRouteGeometry = z
geometry: z.unknown(),
sampleTimestamps: z
.array(
z.object({
t: isoDateTime(),
speedMs: z.number().optional(),
hr: z.number().int().optional(),
}),
z.union([
isoDateTime(),
z.object({
t: isoDateTime(),
speedMs: z.number().optional(),
hr: z.number().int().optional(),
}),
]),
)
.nullable()
.describe(
"One entry per geometry point, as the track was ingested: its instant and, where recorded, speed (m/s) and heart rate (bpm).",
"One entry per geometry point, as the track was stored: a bare instant, or (from the workout batch and the Apple Health export) an object with its instant and, where recorded, speed (m/s) and heart rate (bpm).",
),
})
.meta({ id: "WorkoutRouteGeometry" });