OpenAPITools / OpenAPITools/openapi-generator
[BUG] [typescript-axios] Query params enum created wrong
Open
Nobody has claimed this yet.
Issue: Bug
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
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?
Description
Wrong enum generated based on query param sort in line 1647
{
"in":"query",
"name":"sort",
"schema":{
"type":"string",
"enum":[
"<id",
">id",
"<name",
">name",
"<code",
">code",
"<description",
">description",
"<start_date",
">start_date",
"<end_date",
">end_date",
"<allowed_uses",
">allowed_uses",
"<current_uses",
">current_uses",
"<discount",
">discount",
"<type",
">type"
],
"description":"Sort of one property",
"example":"<id"
}
}
Result:
export enum CouponQueryParamsSortEnum {
Id = '<id',
Id = '>id',
Name = '<name',
Name = '>name',
Code = '<code',
Code = '>code',
Description = '<description',
Description = '>description',
StartDate = '<start_date',
StartDate = '>start_date',
EndDate = '<end_date',
EndDate = '>end_date',
AllowedUses = '<allowed_uses',
AllowedUses = '>allowed_uses',
CurrentUses = '<current_uses',
CurrentUses = '>current_uses',
Discount = '<discount',
Discount = '>discount',
Type = '<type',
Type = '>type'
}
openapi-generator version
5.2.1
OpenAPI declaration file content or url
https://gist.github.com/exejutable/f16d52315a95d95705ef6b694d962981
Generation Details
openapi-generator-cli generate -g typescript-axios -o src -i openapi.json
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 the linked OpenAPI declaration and run the provided typescript-axios generation command against it. Trace the typescript-axios enum generation that produces duplicate member names for the query parameter values. Done means the generated enum has valid distinct member names while preserving all listed values, verified against the reported output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi, typescript
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100