-
Notifications
You must be signed in to change notification settings - Fork 207
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
csharp Warnings with x-www-form-urlencoded and array parameters #3569
Comments
Thanks for trying kiota and for reaching out. |
Using Kiota tool 1.7.0, it seems to be here https://github.com/microsoft/kiota/blob/main/src/Kiota.Builder/Validation/UrlFormEncodedComplex.cs
|
Thanks for the additional information. I missed the fact that your schema is using an array. The reason why we don't support arrays is because there's no standard way of serializing them:
For reference, we added this validation rule with this issue #2019 |
@baywet but it does do arrays, it does them as duplicate variables like your first example. See links below. And, the OpenAPI has the option (collectionFormat) to tell the client how it expects the array to be passed, with csv being the default. https://github.com/microsoft/kiota-serialization-form-dotnet/blob/main/src/FormSerializationWriter.cs#L81 |
Thanks for pointing this out, I think I got confused. @andrueastman I know we talked about this at length in the past. Between this in dotnet, and that typescript PR I believe my last statement was wrong. |
Shouldn't the serializer be updated to read the collectionFormat value to know how to write the arrays? |
The equivalent of which is form with explode in OAS v3. The challenge being we're not carrying the explode information and we actually have a divergence of implementation:
this is related to #3238 Let's focus on the generation for a bit, in your scenario, while trying to reproduce it, I was getting the warning, but at least I was getting the generated code out, is that your experience as well? |
Yes, that is my experience as well. Luckily the default behavior to write multiple var=value to the form data is how the API is expecting the data. But if it was expecting it to be csv, we would have issues having Kiota as an option for generating API clients. |
thanks for confirming, so I'm guessing the first step is to remove the validation for arrays. And then once this is done, later in #3238 we'll normalize the explode behaviour based on the information that needs to be passed (which we can't pass today without resulting in a breaking change) |
Update: for the validation rule fix I put together #3593. |
Can you explain the breaking change, and why defaults that are already being assumed can't be put in place? |
This method needs to be passed the explode information. This would result in adding an additional parameter to the method to drive the different in behavior. |
Based on the closed issue #2291 and #219 is the c# serializer working for form data arrays?
When I try to generate a client using a schema that has
application/x-www-form-urlencoded
and parameters with type set asarray
, I get the following warning.The text was updated successfully, but these errors were encountered: