Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RouteOptions.alleyPriority, walkwayPriority, speed are now optional #557

Merged
merged 8 commits into from
Jul 8, 2021

Conversation

jill-cardamon
Copy link
Contributor

This PR addresses #553 by making RouteOptions.alleyPriority, walkwayPriority, and speed optional properties and conditionally adding their corresponding URL query items to RouteOptions.urlQueryItems.

@jill-cardamon jill-cardamon added backwards incompatible changes that break backwards compatibility of public API op-ex Refactoring, Tech Debt or any other operational excellence work. labels Jun 30, 2021
@jill-cardamon jill-cardamon added this to the v2.0.0 (RC) milestone Jun 30, 2021
@jill-cardamon jill-cardamon requested a review from a team June 30, 2021 19:43
@jill-cardamon jill-cardamon self-assigned this Jun 30, 2021
@jill-cardamon

This comment has been minimized.

Copy link
Contributor

@S2Ler S2Ler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we also need update examples and some docs after this PR?

@@ -129,7 +129,7 @@ open class RouteOptions: DirectionsOptions {

The value of this property must be at least `DirectionsPriority.low` and at most `DirectionsPriority.high`. The default value of `DirectionsPriority.default` neither prefers nor avoids alleys, while a negative value between `DirectionsPriority.low` and `DirectionsPriority.default` avoids alleys, and a positive value between `DirectionsPriority.default` and `DirectionsPriority.high` prefers alleys. A value of 0.9 is suitable for pedestrians who are comfortable with walking down alleys.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment needs an update. There is no "default" anymore. Also, it needs an explanation of what 'nil' means.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for the other properties too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you both! I will update the docs. Some examples can be updated after the next release. I can open a ticket for tail work.

@S2Ler S2Ler requested a review from a team July 1, 2021 10:22
@@ -99,6 +99,7 @@ public struct DirectionsPriority: Hashable, RawRepresentable {
/**
The priority level with which a route neither avoids nor prefers a particular type of roadway or pathway.
*/
// should we remove this default (or change its naming) if we don't set it as such?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, medium (as in “medium priority”) would be better, since apparently the API reserves the right to use a different default at some point in the future, even if that would be somewhat nonsensical for a relative value.

@@ -129,7 +129,7 @@ open class RouteOptions: DirectionsOptions {

The value of this property must be at least `DirectionsPriority.low` and at most `DirectionsPriority.high`. The default value of `DirectionsPriority.default` neither prefers nor avoids alleys, while a negative value between `DirectionsPriority.low` and `DirectionsPriority.default` avoids alleys, and a positive value between `DirectionsPriority.default` and `DirectionsPriority.high` prefers alleys. A value of 0.9 is suitable for pedestrians who are comfortable with walking down alleys.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for the other properties too.

@jill-cardamon jill-cardamon force-pushed the jill/alleyPriorityOptional-553 branch from 78a837d to 32f8089 Compare July 1, 2021 22:53
@jill-cardamon jill-cardamon changed the base branch from release-v2.0 to main July 1, 2021 22:54
Copy link
Contributor

@1ec5 1ec5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to go as soon as the documentation feedback is addressed. Thanks for knocking this one out!


This property has no effect unless the profile identifier is set to `DirectionsProfileIdentifier.walking`. You can adjust this property to account for running or for faster or slower gaits. When the profile identifier is set to another profile identifier, such as `DirectionsProfileIdentifier.driving`, this property is ignored in favor of the expected travel speed on each road along the route. This property may be supported by other routing profiles in the future.
This property has no effect unless it is explicitly set as it defaults to nil, and works best when the profile identifier is set to `DirectionsProfileIdentifier.walking`. You can adjust this property to account for running or for faster or slower gaits. When the profile identifier is set to another profile identifier, such as `DirectionsProfileIdentifier.driving`, this property is ignored in favor of the expected travel speed on each road along the route. This property may be supported by other routing profiles in the future.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We named the property just speed on the client side in case there’s ever something like a cycling_speed, to avoid a proliferation of profile-specific properties on the class, but for now it’s only hooked up to walking_speed.

Although this PR technically allows the property to be set in other profiles, I think we should continue to document it as a walking-only option for now. We don’t want developers to get the impression that it works with any profile and get surprised about an error. If for some reason the API were to support walking_speed for, say, the mapbox/driving-traffic profile, that usage would remain possible but undocumented, which I think is OK.

/cc @danpat


/**
The expected uniform travel speed measured in meters per second.
An optional that represents the expected uniform travel speed measured in meters per second.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It isn’t necessary to call out the optionality of the type; that’s already clear to the developer in Swift. It is important to note what happens if the property is unspecified: I think we can simply say for all three properties that the Directions API will choose the most reasonable value.


This property has no effect unless the profile identifier is set to `DirectionsProfileIdentifier.automobile` or `DirectionsProfileIdentifier.walking`.
This property has no effect unless it is explicitly set as it defaults to nil, and works best when the profile identifier is set to `DirectionsProfileIdentifier.automobile` or `DirectionsProfileIdentifier.walking`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Directions API documentation doesn’t explicitly restrict this option to any particular profile, even if it happens to be unsupported in the cycling profile, so I think we can remote this note entirely. It’s probably unnecessary to state that an unset property is set to nil and therefore has no effect, since no default value is present in the property signature.


This property has no effect unless the profile identifier is set to `DirectionsProfileIdentifier.walking`. You can adjust this property to avoid [sidewalks and crosswalks that are mapped as separate footpaths](https://wiki.openstreetmap.org/wiki/Sidewalks#Sidewalk_as_separate_way), which may be more granular than needed for some forms of pedestrian navigation.
This property has no effect unless it is explicitly set as it defaults to nil, and works best when the profile identifier is set to `DirectionsProfileIdentifier.walking`. You can adjust this property to avoid [sidewalks and crosswalks that are mapped as separate footpaths](https://wiki.openstreetmap.org/wiki/Sidewalks#Sidewalk_as_separate_way), which may be more granular than needed for some forms of pedestrian navigation.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Directions API documentation explicitly limits this option to the mapbox/walking profile. I think it’s safer to retain the documentation as it was, for consistency with the API documentation, even as we remove the formal client-side check.

@jill-cardamon jill-cardamon merged commit 55e5531 into main Jul 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backwards incompatible changes that break backwards compatibility of public API op-ex Refactoring, Tech Debt or any other operational excellence work.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RouteOptions.alleyPriority, walkwayPriority, speed should be optional
3 participants