Skip to content

Ensure /tracking is backwards compatible#305

Merged
alanna-zhou merged 6 commits into
masterfrom
alanna/old-tracking
Sep 12, 2020
Merged

Ensure /tracking is backwards compatible#305
alanna-zhou merged 6 commits into
masterfrom
alanna/old-tracking

Conversation

@alanna-zhou
Copy link
Copy Markdown
Contributor

@alanna-zhou alanna-zhou commented Sep 10, 2020

Overview

⚠️ Please check the below example requests before you ask me questions plz ⚠️

A !! VERY IMPORTANT !! note to Android & iOS Refactorers:

Last semester, Android requested that I change the POST request field routeID:string to be routeNumber:integer because that was consistent with v2/route. However, this won't work with old iOS clients, who send in routeID:string and expect routeID:integer as a response. Don't ask me why this isn't consistent, but it looks like Android will just have to deal with this. So, whatever we return routeNumber:integer in v2/route, just change the name to routeID and cast it to a string before putting into v2/tracking. Make sure you expect the response to be routeID:integer as well.

Thanks to @Omarrasheed, I've updated the response to include everything that the iOS clients need:

Screen Shot 2020-09-10 at 4 32 46 PM

Changes Made

Update /tracking so that old iOS clients still work
Update docker images so we can run locally

Test Coverage

Tested locally works, going to be deploying

Next Steps

Update microservice to include vehicle id and other fields

Related PRs or Issues

#292
#295

Old Request Example - let's try to deprecate this

Request Body

Screen Shot 2020-09-10 at 2 23 07 PM

For you to copy and paste: { "data" : [ { "stopID" : "523", "routeID" : "82", "tripIdentifiers" : [ "t6A4-b1D-slC", "t60B-b7-slC" ] }, { "stopID" : "1701", "routeID" : "30", "tripIdentifiers" : [ "t60B-b7-slC" ] } ] }

Response Body

backwards_compat.txt

New Request Example

Request Body

Screen Shot 2020-09-10 at 2 27 12 PM

For you to copy and paste: { "data": [ { "tripID": "t665-bF-slC", "routeID": "41" }, { "tripID": "t64D-b30-slC", "routeID": "37" } ] }

Response Body

same_response_diff_values.txt

Copy link
Copy Markdown
Contributor

@Omarrasheed Omarrasheed left a comment

Choose a reason for hiding this comment

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

Lgtm. Let's try to always keep back compat in mind when making these changes. Ik Android has had lots of issues w our naming conventions and types, but these things are not v easy to change.

};
}
return {
bearing: vehicleData.bearing,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

These, and all other new fields, can still be added.

routeID: Number(routeID), // although input is string, old clients expect a number
runID: 0,
speed: vehicleData.speed,
timestamp: vehicleData.timestamp,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same

}
return {
bearing: vehicleData.bearing,
congestionLevel: vehicleData.congestionLevel,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same

Copy link
Copy Markdown
Contributor

@aliciaxw aliciaxw left a comment

Choose a reason for hiding this comment

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

thanks for the documentation!

* tripID : String
* },... ]
* NOTE: Because we need to provide backwards compatibility with old iOS clients
* we have to follow their janky way of routeID input is String but routeID
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

the drama of it all!

@alanna-zhou alanna-zhou merged commit 427141b into master Sep 12, 2020
cindy-x-liang pushed a commit that referenced this pull request Oct 9, 2025
* Add refactor

* Add both ways working

* Add some comments

* Fix more omar requests

* Edit more fields

* Update old dockerfile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants