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

Deprecated serialized fields #1447

Merged
merged 2 commits into from
Jun 6, 2022
Merged

Deprecated serialized fields #1447

merged 2 commits into from
Jun 6, 2022

Conversation

VysotskiVadim
Copy link
Contributor

mapbox-java used to serialized access-token and uuid when a user calls RouteOptions#toJson(). You will get an invalid URL If you deserialize RouteOptions from a json, which contains access-token or uuid, and then call RouteOptions#toURL.

@VysotskiVadim VysotskiVadim requested a review from a team as a code owner May 31, 2022 12:15
@@ -968,6 +976,9 @@ public URL toUrl(@NonNull String accessToken) {
if (unrecognized != null) {
for (Map.Entry<String, SerializableJsonElement> entry : unrecognized.entrySet()) {
JsonElement element = entry.getValue().getElement();
if (DEPRECATED_SERIALIZED_FIELDS.contains(entry.getKey())) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Guardiola31337 , @LukasPaczos , @mapbox/navigation-android , do you think this simple mechanism is sufficient?

Copy link
Member

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

Choose a reason for hiding this comment

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

A warning log could be good.

@codecov
Copy link

codecov bot commented May 31, 2022

Codecov Report

Merging #1447 (3ee83bc) into main (cb85935) will increase coverage by 0.04%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##               main    #1447      +/-   ##
============================================
+ Coverage     75.63%   75.67%   +0.04%     
- Complexity      879      881       +2     
============================================
  Files           125      125              
  Lines          3899     3906       +7     
  Branches        577      578       +1     
============================================
+ Hits           2949     2956       +7     
  Misses          687      687              
  Partials        263      263              
Impacted Files Coverage Δ
.../mapbox/api/directions/v5/models/RouteOptions.java 85.86% <100.00%> (+0.55%) ⬆️

Copy link
Contributor

@RingerJK RingerJK 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 add a check (+logs) to toUrl that checks that we don't have the same queries twice or more time. wdyt?

@VysotskiVadim
Copy link
Contributor Author

Let's add a check (+logs) to toUrl that checks that we don't have the same queries twice or more time. wdyt?

@RingerJK , how do you think, what's the best think we can do if there're duplicated parameters? Throw an exceptions with an understandable description?

@RingerJK
Copy link
Contributor

RingerJK commented Jun 3, 2022

I think logs with w level should be good.

Copy link
Contributor

@Guardiola31337 Guardiola31337 left a comment

Choose a reason for hiding this comment

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

Should we add a sanity test that serializes a legacy DirectionsResponse JSON like multiple_routes.json and verifies that the URL doesn't contain neither a duplicated access_token nor the uuid? 🤔

@VysotskiVadim
Copy link
Contributor Author

Should we add a sanity test that serializes a legacy DirectionsResponse JSON like multiple_routes.json and verifies that the URL doesn't contain neither a duplicated access_token nor the uuid? 🤔

added, see sanityCheckForPreviouslySerializedRouteResponse

@VysotskiVadim
Copy link
Contributor Author

I think logs with w level should be good.

@RingerJK , @LukasPaczos , I don't see any logging mechanisms in mapbox-java. Do you think it's time to introduce one?

TBH, I don't think that it's time 🙂

@RingerJK
Copy link
Contributor

RingerJK commented Jun 6, 2022

I think logs with w level should be good.

@RingerJK , @LukasPaczos , I don't see any logging mechanisms in mapbox-java. Do you think it's time to introduce one?

TBH, I don't think that it's time 🙂

suppose, mapbox-java contains business logic, so it's time to investigate if it needs a logging mechanism. Let's cut a ticket

@VysotskiVadim VysotskiVadim mentioned this pull request Jun 6, 2022
@VysotskiVadim
Copy link
Contributor Author

I think logs with w level should be good.

@RingerJK , @LukasPaczos , I don't see any logging mechanisms in mapbox-java. Do you think it's time to introduce one?
TBH, I don't think that it's time 🙂

suppose, mapbox-java contains business logic, so it's time to investigate if it needs a logging mechanism. Let's cut a ticket

#1448

@RingerJK
Copy link
Contributor

RingerJK commented Jun 6, 2022

as we still don't have logger, could you put // TODO log.W("CONTEXT") (replace W by any other level where it needs) to places that must be logged

@VysotskiVadim
Copy link
Contributor Author

as we still don't have logger, could you put // TODO log.W("CONTEXT") (replace W by any other level where it needs) to places that must be logged

Added to the logger ticket instead #1448 (comment)

Copy link
Contributor

@RingerJK RingerJK left a comment

Choose a reason for hiding this comment

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

LGTM

@VysotskiVadim VysotskiVadim merged commit a15e481 into main Jun 6, 2022
@VysotskiVadim VysotskiVadim deleted the vv-fix-old-jsons-parsing branch June 6, 2022 11:51
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.

None yet

4 participants