Skip to content

Commit 503fac0

Browse files
authored
♻️ deprecate trainDistance and trainDuration fields in EventDetailsResource (#4554)
1 parent 6cdaa12 commit 503fac0

File tree

4 files changed

+49
-8
lines changed

4 files changed

+49
-8
lines changed

API_CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ Check back here regularly to stay ahead of removals.
1414

1515
| Announced | What? | Safe until | PR |
1616
|------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------|---------------------------------------------------------------|
17+
| 2026-03-07 | `EventDetailsResource.trainDistance` is deprecated → use `totalDistance` instead | 2026-09-30 | [#4554](https://github.com/Traewelling/traewelling/pull/4554) |
18+
| 2026-03-07 | `EventDetailsResource.trainDuration` is deprecated → use `totalDuration` instead | 2026-09-30 | [#4554](https://github.com/Traewelling/traewelling/pull/4554) |
1719
| 2026-03-07 | `CheckinSuccessResource.points.additional` is always `null` and deprecated | 2026-09-30 | [#4553](https://github.com/Traewelling/traewelling/pull/4553) |
1820
| 2026-03-07 | `DepartureResource.destination` is deprecated → use `direction` instead | 2026-09-30 | [#4552](https://github.com/Traewelling/traewelling/pull/4552) |
1921
| 2026-03-07 | `DepartureResource.delay` is deprecated → use `when`/`plannedWhen` difference instead | 2026-09-30 | [#4552](https://github.com/Traewelling/traewelling/pull/4552) |
@@ -34,6 +36,9 @@ Check back here regularly to stay ahead of removals.
3436

3537
# 2026-03-07
3638

39+
The `EventDetailsResource` fields `trainDistance` and `trainDuration` are now **deprecated** and will be removed after **2026-09-30**.
40+
Use `totalDistance` and `totalDuration` instead — both fields are now returned alongside the old ones.
41+
3742
The `CheckinSuccessResource.points.additional` field is now **deprecated** (always `null`) and will be removed after **2026-09-30**.
3843

3944
The following fields of `DepartureResource` are now **deprecated** and will be removed after **2026-09-30**:

app/Http/Resources/EventDetailsResource.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010
properties: [
1111
new OA\Property(property: 'id', type: 'integer', example: 39),
1212
new OA\Property(property: 'slug', type: 'string', example: '9_euro_ticket'),
13-
new OA\Property(property: 'trainDistance', type: 'integer', example: 12345),
14-
new OA\Property(property: 'trainDuration', type: 'integer', example: 12345),
13+
new OA\Property(property: 'totalDistance', description: 'distance travelled in meters', type: 'integer', example: 12345),
14+
new OA\Property(property: 'totalDuration', description: 'duration travelled in minutes', type: 'integer', example: 12345),
15+
new OA\Property(property: 'trainDistance', description: 'Deprecated. Use totalDistance instead.', type: 'integer', example: 12345, deprecated: true),
16+
new OA\Property(property: 'trainDuration', description: 'Deprecated. Use totalDuration instead.', type: 'integer', example: 12345, deprecated: true),
1517
],
1618
)]
1719
class EventDetailsResource extends JsonResource
@@ -21,8 +23,10 @@ public function toArray($request): array
2123
return [
2224
'id' => $this->id,
2325
'slug' => $this->slug,
24-
'trainDistance' => $this->totalDistance, // @todo: rename key - we have more than just trains
25-
'trainDuration' => $this->totalDuration, // @todo: rename key - we have more than just trains
26+
'totalDistance' => $this->totalDistance,
27+
'totalDuration' => $this->totalDuration,
28+
'trainDistance' => $this->totalDistance, // @deprecated - remove after 2026-09-30
29+
'trainDuration' => $this->totalDuration, // @deprecated - remove after 2026-09-30
2630
];
2731
}
2832
}

resources/types/Api.gen.ts

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,9 +1006,27 @@ export interface EventDetailsResource {
10061006
id?: number;
10071007
/** @example "9_euro_ticket" */
10081008
slug?: string;
1009-
/** @example 12345 */
1009+
/**
1010+
* distance travelled in meters
1011+
* @example 12345
1012+
*/
1013+
totalDistance?: number;
1014+
/**
1015+
* duration travelled in minutes
1016+
* @example 12345
1017+
*/
1018+
totalDuration?: number;
1019+
/**
1020+
* Deprecated. Use totalDistance instead.
1021+
* @deprecated
1022+
* @example 12345
1023+
*/
10101024
trainDistance?: number;
1011-
/** @example 12345 */
1025+
/**
1026+
* Deprecated. Use totalDuration instead.
1027+
* @deprecated
1028+
* @example 12345
1029+
*/
10121030
trainDuration?: number;
10131031
}
10141032

storage/api-docs/api-docs.json

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6908,13 +6908,27 @@
69086908
"type": "string",
69096909
"example": "9_euro_ticket"
69106910
},
6911-
"trainDistance": {
6911+
"totalDistance": {
6912+
"description": "distance travelled in meters",
69126913
"type": "integer",
69136914
"example": 12345
69146915
},
6915-
"trainDuration": {
6916+
"totalDuration": {
6917+
"description": "duration travelled in minutes",
69166918
"type": "integer",
69176919
"example": 12345
6920+
},
6921+
"trainDistance": {
6922+
"description": "Deprecated. Use totalDistance instead.",
6923+
"type": "integer",
6924+
"example": 12345,
6925+
"deprecated": true
6926+
},
6927+
"trainDuration": {
6928+
"description": "Deprecated. Use totalDuration instead.",
6929+
"type": "integer",
6930+
"example": 12345,
6931+
"deprecated": true
69186932
}
69196933
},
69206934
"type": "object"

0 commit comments

Comments
 (0)