Go: Broken Generated Code when Body is an Array of Scalar Values #4380
Labels
Go
help wanted
Issue caused by core project dependency modules or library
type:bug
A broken experience
Milestone
Hey team 👋
Hope this is the right place to open Golang generation issues, today I faced a weird issue that I will try to describe below.
It seems that the generator produces a broken Golang code when trying to parse a
body
made by an array of scalars.The generated
ToPostRequestInformation
is something like:The issue is that
requestInfo.SetContentFromScalarCollection(ctx, m.BaseRequestBuilder.RequestAdapter, "application/json", body)
cannot receivebody
(which is a[]int32
) as it is expecting a[]interface{}
type which is not allowed [1].Maybe I missed something or I am doing something wrong (in that case, please let me know) but I think that the openapi is a valid one, therefore I am expecting a valid generated code.
Version
How to reproduce the issue
To reproduce the issue I took the
posts
quickstart from the doc and I simply modified it to have a body made by a list of scalars.kiota generate -l go -c PostsClient -n kiota_posts/client -d ./posts-api.yaml -o ./client
[1] https://go.dev/wiki/InterfaceSlice
The text was updated successfully, but these errors were encountered: