OpenAPITools / OpenAPITools/openapi-generator

[BUG] [typescript-axios] Property of number type incorrectly typed as BigDecimal

Open
#5,919 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description

When generating an openapi using the typescript-axios tool, a property with type as string and format as number generates a type BigDecimal for the generated api.ts file. However, the BigDecimal type does not exist.

example -

properties:
    example:
        type: string
        format: number

generated code -

/**
 * 
 * @export
 * @interface Example
 */
export interface Example {
    /**
     * Example
     * @type {BigDecimal}
     * @memberof Example
     */
    example?: BigDecimal;
}
openapi-generator version

1.0.12-4.3.0

Command line used for generation

node node_modules/@openapitools/openapi-generator-cli/bin/openapi-generator generate -i ./src/openapi.yaml -g typescript-axios -o ./lib -c ./config.json

Related issues/PRs

This may be related - Link to an issue in swagger-codegen

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 report with the supplied YAML property, generation command, and typescript-axios generator, then inspect the generated api.ts output. Trace the type mapping for a string property using format number and add or update coverage for this case. Done means the generated interface uses a defined TypeScript type instead of BigDecimal.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.