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

[core-client-rest] Set comma as parametrized path delimiter #24997

Merged
merged 2 commits into from
Feb 27, 2023

Conversation

joheredi
Copy link
Member

Packages impacted by this PR

@azure-rest/core-client

Issues associated with this PR

#24982

Describe the problem that is addressed by this PR

Currently core-client-rest fills in parameterized paths assuming that there will be only one parametrized element in a given path part. As surfaced in the linked issue, there are scenarios where a single path part can have more than one parameter.

What are the possible designs available to address the problem? If there are more than one possible design, why was the one in this PR chosen?

Currently we only consider / as a delimiter to look for the next path parameter. Adding , as a delimiter addresses this issue.

Are there test cases added in this PR? (If not, why?)

Yes

Provide a list of related PRs (if any)

N/A

@joheredi joheredi requested a review from NickKouds February 24, 2023 19:55
@ghost ghost added the Azure.Core label Feb 24, 2023
@joheredi joheredi marked this pull request as ready for review February 24, 2023 19:55
@@ -103,7 +103,7 @@ function buildRoutePath(
value = encodeURIComponent(pathParam);
}

routePath = routePath.replace(/{([^/]+)}/, value);
routePath = routePath.replace(/{([^/,]+)}/, value);
Copy link
Member

Choose a reason for hiding this comment

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

are there other valid separators that we care about?

Copy link
Member Author

Choose a reason for hiding this comment

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

I haven't found any other separators. However your comment got me thinking we could use a more robust regex like

/\{\w+\}/ which doesn't really need it to care about separators

@azure-sdk
Copy link
Collaborator

API change check

API changes are not detected in this pull request.

@joheredi joheredi merged commit 8ee4597 into Azure:main Feb 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants