typespec
typespec copied to clipboard
[Bug]: Duplicate base path in generated RestClient URLs when server template contains path segments
Describe the bug
When the server URL template contains a base path (e.g., {endpoint}/contentsafety), the generated RestClient duplicates the base path in the request URL.
Example:
Server template: {endpoint}/contentsafety Operation path: /text:analyze Expected URL: {endpoint}/contentsafety/text:analyze Actual URL: {endpoint}/contentsafety/contentsafety/text:analyze
Reproduction
- Use the http-client-csharp generator to generate code for the Azure.AI.ContentSafety service
- Examine the generated ContentSafetyClient.cs file
- Observe that RestClient URLs contain duplicate /contentsafety base path:
- Expected: {endpoint}/contentsafety/text:analyze
- Actual: {endpoint}/contentsafety/contentsafety/text:analyze
Checklist
- [x] Follow our Code of Conduct
- [x] Check that there isn't already an issue that request the same bug to avoid creating a duplicate.
- [x] Check that this is a concrete bug. For Q&A open a GitHub Discussion.
- [x] The provided reproduction is a minimal reproducible example of the bug.