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

api: allow urlencoded path parameters, java client: properly urlencode path parameters #1419

Merged
merged 1 commit into from
Jun 22, 2021

Conversation

mobuchowski
Copy link
Contributor

Use HttpCompliance.RFC7230_LEGACY to allow potentially ambiguous URIs with encoded path segments.
Refactor Marquez Java client to properly urlencode path segments.

@codecov
Copy link

codecov bot commented Jun 17, 2021

Codecov Report

Merging #1419 (506ac91) into main (5145d63) will decrease coverage by 0.07%.
The diff coverage is 60.00%.

❗ Current head 506ac91 differs from pull request most recent head 0af7a69. Consider uploading reports for the commit 0af7a69 to get more accurate results
Impacted file tree graph

@@             Coverage Diff              @@
##               main    #1419      +/-   ##
============================================
- Coverage     79.80%   79.73%   -0.08%     
- Complexity      916      922       +6     
============================================
  Files           197      197              
  Lines          5759     5778      +19     
  Branches        393      397       +4     
============================================
+ Hits           4596     4607      +11     
- Misses          744      747       +3     
- Partials        419      424       +5     
Impacted Files Coverage Δ
...main/java/marquez/common/models/NamespaceName.java 80.00% <ø> (ø)
...ients/java/src/main/java/marquez/client/Utils.java 77.27% <0.00%> (-4.55%) ⬇️
...java/src/main/java/marquez/client/HttpBackend.java 78.26% <25.00%> (-11.22%) ⬇️
...va/src/main/java/marquez/client/MarquezPathV1.java 71.42% <64.70%> (-3.58%) ⬇️
.../java/src/main/java/marquez/client/MarquezUrl.java 70.73% <100.00%> (ø)
...ava/marquez/client/MarquezWriteOnlyClientImpl.java 84.61% <100.00%> (-0.39%) ⬇️
api/src/main/java/marquez/db/TagDao.java 100.00% <0.00%> (ø)
...in/java/marquez/client/MarquezClientException.java 33.33% <0.00%> (+33.33%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5145d63...0af7a69. Read the comment docs.

@@ -89,7 +88,7 @@ public void testCreateRunWithId() {
RunMeta runMeta = RunMeta.builder().id(id).build();
client.createRun("namespaceName", "jobName", runMeta);
verify(backend, times(1))
.post("/api/v1/namespaces/namespaceName/jobs/jobName/runs", runMeta.toJson());
Copy link
Contributor

Choose a reason for hiding this comment

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

what do you think about handling this case also in method?
private URL url(String path) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Any idea of something better than

      if (baseUrl.toString().endsWith("/") && path.startsWith("/")) {
        path = path.substring(1);
      } else if (!baseUrl.toString().endsWith("/") && !path.startsWith("/")) {
        path = "/" + path;
      }

@mobuchowski mobuchowski force-pushed the fix-namespace-path-parsing branch 2 times, most recently from 623a293 to 3504d08 Compare June 18, 2021 10:18
@mobuchowski mobuchowski force-pushed the fix-namespace-path-parsing branch 2 times, most recently from da0ed70 to 628a0c8 Compare June 21, 2021 10:42
@mobuchowski
Copy link
Contributor Author

@wslulciuc @OleksandrDvornik can we merge it?

@OleksandrDvornik
Copy link
Contributor

looks good for me

Copy link
Member

@wslulciuc wslulciuc left a comment

Choose a reason for hiding this comment

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

@mobuchowski, changes look great! I left a comment about reverting some changes related to the paths that are internal. Once reverted, we're good to merge 👍

@mobuchowski mobuchowski force-pushed the fix-namespace-path-parsing branch 5 times, most recently from cd72250 to 4e801ae Compare June 22, 2021 13:04
Signed-off-by: Maciej Obuchowski <maciej.obuchowski@getindata.com>
Copy link
Member

@wslulciuc wslulciuc left a comment

Choose a reason for hiding this comment

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

LGTM 👍 💯 🥇

@wslulciuc wslulciuc merged commit d41619b into main Jun 22, 2021
@wslulciuc wslulciuc deleted the fix-namespace-path-parsing branch June 22, 2021 19:40
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