fern-api / fern

Input OpenAPI. Output SDKs and Docs.
https://buildwithfern.com
MIT License
2.45k stars 118 forks source link

(fix, go): Handle deepObject query parameter arrays #3836

Closed amckinney closed 3 weeks ago

amckinney commented 3 weeks ago

This fixes an issue in the Go SDK and adds support for serializing an array of struct types in the deepObject query parameter format. The format is now consistent with the TypeScript SDK (and all others).

For posterity, an example of a deepObject array is shown below:

  user, err := client.Users.Get(
    ...,
    acme.GetUserRequest{
      Filters: []*acme.Filter{
        {
          Key: "age",
          Value: "42",
        },
        {
          Key: "firstName",
          Value: "john",
        },
      },
    },
  )
  // Serialized as: ?filters[key]=age&filters[key]=firstName&filters[value]=42&filters[value]=john