Skip to content

Fix pebble for array-type query parameter #586

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

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
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.

1 participant