OpenAPITools / OpenAPITools/openapi-generator

[BUG][typescript-axios] Interfaces properties are quoted

Open
#20,167 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Description

Hi, I am generating a client using typescript-axios generator and in models, all the fields are wrapped into quotes and I can't turn it off. It is not a problem, until a field name contains some enum constant, because in this case it is escaped. When I am adding an option queryParamObjectFormat=key, it does nothing.

This is an example how a generated interface looks like:

export interface Pet {
   'name': string;
   'category'?: Category;
   '[MyEnum.A]': string;
   ...
}

But I expect it to look like this:

export interface Pet {
   name: string;
   category?: Category;
   [MyEnum.A]: string;
   ...
}
openapi-generator version

7.9.0

Generation Details
java -jar openapi-generator-cli.jar generate -i openapi.yaml -g typescript-axios -o generated/api --additional-properties=queryParamObjectFormat=key,apiPackage==api,modelPackage=models,withSeparateModelsAndApi=true,stringEnums=true --api-name-suffix=ApiService

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the shown openapi-generator-cli command and the typescript-axios generator. Trace the generator path that produces the quoted model properties; done means the generated Pet interface matches the unquoted example, including the enum-style property, without relying on queryParamObjectFormat=key.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, typescript
Domain
api, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.