Bug Report Checklist
Description
When a required parameter with the name url is included, url is used as the query parameter name in the function parameter list which conflicts with the net/url package that is loaded for query and form requests. This results in the following compile time error:
../../engagedigital/api_webhooks.go:68:28: url.Values undefined (type string has no field or method Values)
The actual output is:
func (a *WebhooksApiService) CreateWebhook(ctx context.Context, accessToken string, label string, url string, registeredEvents []string, localVarOptionals *CreateWebhookOpts) (Webhook, *http.Response, error) {
var (
localVarHttpMethod = http.MethodPost
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue Webhook
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/webhooks"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
The expected output is no collision between parameter name url and the net/url library when instantiating url.Values{}.
openapi-generator version
4.1.0-SNAPSHOT
OpenAPI declaration file content or url
https://raw.githubusercontent.com/grokify/go-ringcentral-engage/8e520ea8355190939c1cc8990ba562fe487095e7/codegen/partial-specs_v3.0.0/openapi-spec_webhooks.json
{
"name":"url",
"in":"query",
"required":true,
"description":"The url of a webhook. This is used to determine the endpoint of your webhook, where",
"schema":{
"type":"string"
}
}
Command line used for generation
java -jar openapi-generator-cli.jar generate -i openapi-spec_v3.0.0.json -g go -o engagedigital --package-name engagedigital
https://github.com/grokify/go-ringcentral-engage/blob/8e520ea8355190939c1cc8990ba562fe487095e7/codegen/generate.sh
Steps to reproduce
Generate a client with a required API query parameter named url and then attempt to compile the resulting library.
Related issues/PRs
none found.
Suggest a fix
Some approaches include:
- When using the the current variable naming approach but adding a
_ suffix, add imported library names to the reserved word list.
- Add a prefix to all parameter names in function definitions.
Bug Report Checklist
Description
When a required parameter with the name
urlis included,urlis used as the query parameter name in the function parameter list which conflicts with thenet/urlpackage that is loaded for query and form requests. This results in the following compile time error:../../engagedigital/api_webhooks.go:68:28: url.Values undefined (type string has no field or method Values)The actual output is:
The expected output is no collision between parameter name
urland thenet/urllibrary when instantiatingurl.Values{}.openapi-generator version
4.1.0-SNAPSHOT
OpenAPI declaration file content or url
https://raw.githubusercontent.com/grokify/go-ringcentral-engage/8e520ea8355190939c1cc8990ba562fe487095e7/codegen/partial-specs_v3.0.0/openapi-spec_webhooks.json
{ "name":"url", "in":"query", "required":true, "description":"The url of a webhook. This is used to determine the endpoint of your webhook, where", "schema":{ "type":"string" } }Command line used for generation
java -jar openapi-generator-cli.jar generate -i openapi-spec_v3.0.0.json -g go -o engagedigital --package-name engagedigitalhttps://github.com/grokify/go-ringcentral-engage/blob/8e520ea8355190939c1cc8990ba562fe487095e7/codegen/generate.sh
Steps to reproduce
Generate a client with a required API query parameter named
urland then attempt to compile the resulting library.Related issues/PRs
none found.
Suggest a fix
Some approaches include:
_suffix, add imported library names to the reserved word list.