-
Notifications
You must be signed in to change notification settings - Fork 33
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
C# - Required parameters are omitted if empty #172
Comments
Thank you for reporting this. I'm pretty sure that's a bug in our URITemplate generation here https://github.com/microsoft/kiota/blob/b2fa1faad08e61a6dad249a443e9b955ec3dc93a/src/Kiota.Builder/Extensions/OpenApiUrlTreeNodeExtensions.cs#L199 . If you state that the parameters are required the key should always appear in the URL.
It think we are currently generating it like this,
I ran into something similar with work I was doing. |
Hi @Ksdmg, |
@baywet , here is the uri template:
|
@Ksdmg Thanks. I think there was a mismatch here. None of the query parameters match what's in the description you've provided (besides the paging ones) and the |
@baywet sorry I got confused because the methods had the same name. Here is the
|
Thanks for confirming, this is most likely caused because of this line at runtime Transferring the issue. |
@Ksdmg do you think you'd be able to implement a unit test for your use case like this one and validate that it fails with the current code, but it passes when the line I outlined is removed? |
@baywet, no I do not have enough knowledge about Kiota to create a meaningful Unit test for this. |
Thanks for letting us know. @andrueastman can you take this over when you have some time please? |
When trying to use this endpoint without all parameters being set, I would expect Kiota to send empty parameters as they have the property "allowEmptyValue" but also are "required".
What Kiota actually does, is it omits these parameters resulting in an error.
As an example, this is the url that swagger generates when I select to sent empty values for all parameters where allowed:
Versus Kiota where all parameters that have not been set are omitted:
I have tried to set the parameters to
string.Empty
and tonull
but both result in the parameters being omitted. The only workaround I found was setting the parameters to a whitespace which will be set by Kiota.The text was updated successfully, but these errors were encountered: