swagger-api / swagger-api/swagger-codegen
[typescript-fetch] Generated authentication configuration file has compile error if the apikey name contains dash -
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
The generated authentication configuration file configuration.ts has compile error if the apikey name contains dash -.
securityDefinitions:
APIKeyHeader:
type: apiKey
in: header
name: X-API-Key
keyParamName has the same string value with swagger spec. Dash is allowed in HTTP header name but not in typescript object key name.
Swagger-codegen version
Official CLI Docker container (master branch)
Related issues/PRs
#4008
Suggest a fix/enhancement
Convert the name to TypeScript compatible identifier in the generated code.
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 with modules/swagger-codegen/src/main/resources/TypeScript-Fetch/configuration.mustache at the referenced line and inspect how keyParamName is emitted into configuration.ts. Generate a TypeScript-Fetch client using an API key named X-API-Key, then verify the generated configuration compiles and handles the header name correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100