-
Notifications
You must be signed in to change notification settings - Fork 215
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
Trailing slash in URL is dropped during generation #4291
Comments
Hi @mderriey, Kiota generates the URI templates here and additional unit tests can be added here The challenge is that kiota relies on OpenAPI.net to parse the description and build the tree of the API. And that process kind of relies on trimming the trailing slashes to work as you can see here and there. In fact it's removing the trailing slash From kiota's perspective, the trailing slash doesn't exist, and adding it systematically would be wrong in the same sense it's wrong to remove it. What needs to happen it:
Would you be willing to work on a pull request for openapi.net? |
This comment was marked as outdated.
This comment was marked as outdated.
My bad, please ignore my last message, after writing a test in the Kiota codebase, I can see now how it comes from Let me open an issue in the OpenAPI.NET repo, thanks again. |
We just fixed trailing slashes in the OpenAPI.NET repo via microsoft/OpenAPI.NET#1835, which was released in 1.6.22. Can we update the OpenAPI.NET dependency to see if it adds trailing slash support in Kiota? |
It looks like the OpenAPI.NET dependency was already updated by dependabot https://github.com/microsoft/kiota/blob/main/src/Kiota.Builder/Kiota.Builder.csproj#L47 once the latest preview includes it, I’ll try it out. |
Thanks for the follow up @jlarmstrongiv ! |
I've just tried kiota v1.19.1, and I can confirm that the issue is resolved for me. I had been using an appendTrailingSlashHandler middleware as a workaround, and I've now tested that my client works as expected with the new client code generated by Kiota v1.19.1, without the need for that middleware. |
Thanks for confirming! Closing. |
Could we re-open this issue? Trailing slashes are still broken in TypeScript |
Oh no! I only tested with a Go client. |
@jlarmstrongiv thanks for letting us know! Do you have more context to share around this issue? |
Hi there
Problem
We're working with an API which endpoints contain trailing slashes, for example
{+baseUrl}/api/v1/app/{app_id}/msg/
.During the client generation, the trailing slash is dropped, and the generated client doesn't work as expected as all requests return a 404.
Repro
For reference, here's a link to the OpenAPI document used here: https://github.com/svix/svix-webhooks/blob/8d32e47e0484f5d0839bce364d8700d2c7457937/openapi.json#L7779
TrailingSlashDroppedIssue4291\Api\V1\App\Item\Msg\MsgRequestBuilder.cs
fileExpected result
Kiota shouldn't manipulate paths defined in the OpenAPI document, or should provide an option to opt out of this behavior.
The text was updated successfully, but these errors were encountered: