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

apiUrl should be able to apply path #10699 #10700

Merged
merged 3 commits into from
Sep 25, 2024
Merged

Conversation

anatol-sialitski
Copy link
Contributor

No description provided.

@anatol-sialitski anatol-sialitski linked an issue Sep 24, 2024 that may be closed by this pull request
Copy link

codecov bot commented Sep 24, 2024

Codecov Report

Attention: Patch coverage is 77.77778% with 8 lines in your changes missing coverage. Please review.

Project coverage is 84.55%. Comparing base (8e10f12) to head (0aa9b10).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...om/enonic/xp/portal/impl/url/UrlBuilderHelper.java 68.75% 1 Missing and 4 partials ⚠️
...va/com/enonic/xp/lib/portal/url/ApiUrlHandler.java 62.50% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #10700      +/-   ##
============================================
- Coverage     84.55%   84.55%   -0.01%     
- Complexity    19958    19971      +13     
============================================
  Files          2633     2633              
  Lines         69255    69290      +35     
  Branches       5588     5591       +3     
============================================
+ Hits          58561    58588      +27     
- Misses         8000     8002       +2     
- Partials       2694     2700       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

const bean = __.newBean<ApiUrlHandler>('com.enonic.xp.lib.portal.url.ApiUrlHandler');
return bean.createUrl(__.toScriptValue(params));
bean.setPath(([] as string[]).concat(path));
Copy link
Contributor

Choose a reason for hiding this comment

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

Single string must not be interpreted as single element array.
We should reserve string to preencoded path.

@@ -8,14 +8,22 @@ const url = portalLib.apiUrl({
params: {
a: 1,
b: 2
}
},
path: 'mypath'
Copy link
Contributor

Choose a reason for hiding this comment

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

mypath/subpath would be a better example

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't agree with that. You left the comment #10698 (comment) where your idea is better, than you wrote here.

@@ -8,14 +8,22 @@ const url = portalLib.apiUrl({
params: {
a: 1,
b: 2
}
},
path: 'mypath'
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
path: 'mypath'
path: 'mypath/subpath'

bean.setPath(([] as string[]).concat(path));
if (path) {
if (Array.isArray(path)) {
bean.setPath(__.toScriptValue(([] as string[]).concat(path)));
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
bean.setPath(__.toScriptValue(([] as string[]).concat(path)));
bean.setPath(__.toScriptValue(path));

{
this.path = value;
if ( value instanceof ScriptValue && ( (ScriptValue) value ).isArray() )
Copy link
Contributor

Choose a reason for hiding this comment

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

it is work of ApiUrlHander.
Also one pathSegments should accept List, another path - accepts path

@anatol-sialitski anatol-sialitski merged commit cc487b6 into master Sep 25, 2024
7 of 9 checks passed
@anatol-sialitski anatol-sialitski deleted the issue-10699 branch September 25, 2024 15:11
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.

apiUrl should be able to apply path
2 participants