Skip to content

Commit

Permalink
Merge pull request #7 from stadiamaps/fix/via-waypoint
Browse files Browse the repository at this point in the history
Fix/via waypoint
  • Loading branch information
Archdoog authored Aug 7, 2024
2 parents 24cb1d9 + aaa4072 commit 8af942f
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 5 deletions.
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.7"
version = "0.0.8"
}
}
}
6 changes: 3 additions & 3 deletions apple/Sources/OSRM/Models/RouteLeg.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ 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]?
/** A Mapbox and Valhalla extension which indicates which waypoints are passed through rather than creating a new leg. */
public var viaWaypoints: [ViaWaypoint]?

public init(distance: Double? = nil, duration: Double? = nil, weight: Double? = nil, summary: String? = nil, steps: [RouteStep]? = nil, annotation: Annotation? = nil, viaWaypoints: [String]? = nil) {
public init(distance: Double? = nil, duration: Double? = nil, weight: Double? = nil, summary: String? = nil, steps: [RouteStep]? = nil, annotation: Annotation? = nil, viaWaypoints: [ViaWaypoint]? = nil) {
self.distance = distance
self.duration = duration
self.weight = weight
Expand Down
38 changes: 38 additions & 0 deletions apple/Sources/OSRM/Models/ViaWaypoint.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//
// ViaWaypoint.swift
//
// Generated by openapi-generator
// https://openapi-generator.tech
//

import Foundation
#if canImport(AnyCodable)
import AnyCodable
#endif

public struct ViaWaypoint: Codable, Hashable {
public var distanceFromStart: Double?
public var geometryIndex: Double?
public var waypointIndex: Int?

public init(distanceFromStart: Double? = nil, geometryIndex: Double? = nil, waypointIndex: Int? = nil) {
self.distanceFromStart = distanceFromStart
self.geometryIndex = geometryIndex
self.waypointIndex = waypointIndex
}

public enum CodingKeys: String, CodingKey, CaseIterable {
case distanceFromStart = "distance_from_start"
case geometryIndex = "geometry_index"
case waypointIndex = "waypoint_index"
}

// Encodable protocol methods

public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(distanceFromStart, forKey: .distanceFromStart)
try container.encodeIfPresent(geometryIndex, forKey: .geometryIndex)
try container.encodeIfPresent(waypointIndex, forKey: .waypointIndex)
}
}
12 changes: 11 additions & 1 deletion openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ components:
default: null
description: A Mapbox and Valhalla extension which indicates which waypoints are passed through rather than creating a new leg.
items:
type: string
type: ViaWaypoint
RouteStep:
type: object
properties:
Expand Down Expand Up @@ -358,6 +358,15 @@ components:
format: double
hint:
type: string
ViaWaypoint:
type: object
properties:
distance_from_start:
type: number
geometry_index:
type: number
waypoint_index:
type: integer
NearestWaypoint:
allOf:
- $ref: '#/components/schemas/Waypoint'
Expand All @@ -376,3 +385,4 @@ components:
type: integer
waypoint_index:
type: integer

0 comments on commit 8af942f

Please sign in to comment.