Skip to content

Commit 5ddf165

Browse files
core: make allowed track sections non-nullable across core
That way, stdcm and the pathfinding api both take an empty set as input should we want to have no track section restriction Signed-off-by: Martin Bourbier <mbourbier28@gmail.com>
1 parent 771c3bd commit 5ddf165

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

core/src/main/kotlin/fr/sncf/osrd/api/stdcm/STDCMEndpoint.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -598,11 +598,11 @@ private fun parseSimulationScheduleItems(
598598
)
599599
}
600600

601-
fun parseTrackSectionIds(infra: FullInfra, trackSectionNames: Set<String>?): Set<TrackSectionId>? {
601+
fun parseTrackSectionIds(infra: FullInfra, trackSectionNames: Set<String>): Set<TrackSectionId>? {
602602
return trackSectionNames
603-
?.mapNotNull { infra.rawInfra.getTrackSectionFromName(it) }
604-
?.toSet()
605-
?.takeIf { it.isNotEmpty() }
603+
.mapNotNull { infra.rawInfra.getTrackSectionFromName(it) }
604+
.toSet()
605+
.takeIf { it.isNotEmpty() }
606606
}
607607

608608
private fun progressCallback(

core/src/main/kotlin/fr/sncf/osrd/api/stdcm/STDCMRequest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class STDCMRequest(
5757
@Json(name = "temporary_speed_limits")
5858
val temporarySpeedLimits: Collection<STDCMTemporarySpeedLimit>,
5959
@Json(name = "work_schedules") val workSchedules: Collection<WorkSchedule> = listOf(),
60-
@Json(name = "allowed_track_sections") val allowedTrackSections: Set<String>?,
60+
@Json(name = "allowed_track_sections") val allowedTrackSections: Set<String> = emptySet(),
6161
)
6262

6363
data class STDCMTemporarySpeedLimit(

0 commit comments

Comments
 (0)