Skip to content

Conversation

@habara-k
Copy link
Contributor

@habara-k habara-k commented May 21, 2025

Description

This PR addresses a modification to the generator responsible for producing the Go SDK from OpenAPI definitions. Specifically, it introduces support for query parameters that include arrays.

Changes

Enhanced the generator to handle array-type query parameters.

Here is an example of how such an API call might look in a shell script:

curl -X GET "https://api.line.me/v2/bot/example?param=value1&param=value2"

Note

Currently, there are no endpoints that utilize such parameters. However, this update is a preparatory step for future API enhancements.

@habara-k
Copy link
Contributor Author

Code before the change

func (client *MessagingApiAPI) GetResourceWithHttpInfo(
	param *[]string,
) (*http.Response, *MessagingApiGetResourceResponse, error) {
	path := "/v2/bot/example"

	req, err := http.NewRequest(http.MethodGet, client.Url(path), nil)
	if err != nil {
		return nil, nil, err
	}

	query := url.Values{}
	query.Add("params", string(params)) // Error! cannot convert status (variable of type *[]string) to type string

	// ...

Code after the change

func (client *MessagingApiAPI) GetResourceWithHttpInfo(
	param *[]string,
) (*http.Response, *MessagingApiGetResourceResponse, error) {
	path := "/v2/bot/example"

	req, err := http.NewRequest(http.MethodGet, client.Url(path), nil)
	if err != nil {
		return nil, nil, err
	}

	query := url.Values{}
	for _, v := range *params {
		query.Add("params", v)
	}

	// ...

@habara-k habara-k requested a review from a team May 21, 2025 07:29
@Yang-33 Yang-33 marked this pull request as draft May 22, 2025 00:49
@habara-k habara-k marked this pull request as ready for review June 9, 2025 03:11
Copy link
Contributor

@eucyt eucyt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@habara-k habara-k added this pull request to the merge queue Jun 10, 2025
Merged via the queue into line:master with commit be340dc Jun 10, 2025
5 checks passed
@habara-k habara-k deleted the fix-array-type-query-parameter branch June 10, 2025 01:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants