Open
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
When the spec includes HTTP headers with hyphens (my-header
), as is the standard, the generated service correctly converts the variable name to camelCase (myHeader
), however at runtime, the requestParams object still uses the hyphen version (params['my-header']
).
Therefore, the variable does not correctly map the value.
openapi-generator version
5.0.0-SNAPSHOT
OpenAPI declaration file content or url
"parameters": [
{
"schema": {
"type": "string"
},
"in": "header",
"name": "my-header",
"required": true
}
]
Generation Details
docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli generate -i /local/api/api.json -t /local/core/swagger/mustache/nodejs-express-server/ -g nodejs-express-server -o /local/server/ --skip-validate-spec
Steps to reproduce
- Create an API specs with required HTTP headers, the header name must include a hyphen
- Generate a nodejs server
- Put a breakpoint in the generate Service, see that the variable is always undefined.
Suggest a fix
Whatever algorithm is used to transform the variable names, should be used when mapping the request params at run time.