OpenAPITools / OpenAPITools/openapi-generator
[BUG][C] "-" in Parametername is converted to "_"
Open
Nobody has claimed this yet.
Issue: Bug
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Version: 4.2.3-SNAPSHOT
parameters:
- name: x-api-token
in: header
description: Authorization Token
required: false
type: string
The generated code is:
char* valueHeader_x_api_token;
keyValuePair_t* keyPairHeader_x_api_token = 0;
if (x_api_token) {
keyHeader_x_api_token = strdup("x_api_token");
valueHeader_x_api_token = strdup((x_api_token));
keyPairHeader_x_api_token = keyValuePair_create(keyHeader_x_api_token, valueHeader_x_api_token);
list_addElement(localVarHeaderParameters, keyPairHeader_x_api_token);
}
but i would expect
keyHeader_x_api_token = strdup("x-api-token");
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start from the C generator's handling of OpenAPI header parameter names and compare the parameter identifier with the emitted header key. Use the supplied x-api-token example to verify that generated variable names remain valid while the emitted key preserves the original hyphenated name.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, openapi
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100