Skip to content

Commit

Permalink
Merge pull request #6 from stadiamaps/feat/via-waypoints
Browse files Browse the repository at this point in the history
Added via_waypoint index extension for mapbox and valhalla flavor
  • Loading branch information
ianthetechie authored Aug 6, 2024
2 parents 373331e + ffd0143 commit 24cb1d9
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/android.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Kotlin CI with Gradle
name: Kotlin

on:
push:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/apple.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test
name: Swift

on:
push:
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ publishing {

groupId = "com.osrm"
artifactId = "api"
version = "0.0.6"
version = "0.0.7"
}
}
}
7 changes: 6 additions & 1 deletion apple/Sources/OSRM/Models/RouteLeg.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,17 @@ public struct RouteLeg: Codable, Hashable {
public var summary: String?
public var steps: [RouteStep]?
public var annotation: Annotation?
/** A valhalla and mapbox extension for via waypoints. */
public var viaWaypoints: [String]?

public init(distance: Double? = nil, duration: Double? = nil, weight: Double? = nil, summary: String? = nil, steps: [RouteStep]? = nil, annotation: Annotation? = nil) {
public init(distance: Double? = nil, duration: Double? = nil, weight: Double? = nil, summary: String? = nil, steps: [RouteStep]? = nil, annotation: Annotation? = nil, viaWaypoints: [String]? = nil) {
self.distance = distance
self.duration = duration
self.weight = weight
self.summary = summary
self.steps = steps
self.annotation = annotation
self.viaWaypoints = viaWaypoints
}

public enum CodingKeys: String, CodingKey, CaseIterable {
Expand All @@ -36,6 +39,7 @@ public struct RouteLeg: Codable, Hashable {
case summary
case steps
case annotation
case viaWaypoints = "via_waypoints"
}

// Encodable protocol methods
Expand All @@ -48,5 +52,6 @@ public struct RouteLeg: Codable, Hashable {
try container.encodeIfPresent(summary, forKey: .summary)
try container.encodeIfPresent(steps, forKey: .steps)
try container.encodeIfPresent(annotation, forKey: .annotation)
try container.encodeIfPresent(viaWaypoints, forKey: .viaWaypoints)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@
}
],
"summary" : "AK 1",
"via_waypoints" : [

],
"weight" : 56.002
}
],
Expand Down
7 changes: 7 additions & 0 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,13 @@ components:
$ref: '#/components/schemas/RouteStep'
annotation:
$ref: '#/components/schemas/Annotation'
via_waypoints:
type: array
nullable: true
default: null
description: A Mapbox and Valhalla extension which indicates which waypoints are passed through rather than creating a new leg.
items:
type: string
RouteStep:
type: object
properties:
Expand Down

0 comments on commit 24cb1d9

Please sign in to comment.