A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/swagger-api/swagger-codegen/issues/8855 below:

[typescript-angular] property of number type incorrectly typed as BigDecimal · Issue #8855 · swagger-api/swagger-codegen · GitHub

Description

When a schema as some properties of number type, they are typed as BigDecimal instead of number in the exported model

Swagger-codegen version

3.0.2

Swagger declaration file content or url
openapi: 3.0.0
info:
  title: TestApi
  version: 1.0.0
paths:
  /test:
    get:
      summary: Test
      operationId: testApi
      responses:
        "200":
          description: Ok
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Response"
components:
  schemas:
    Response:
      type: object
      properties:
        propA:
          type: number
        propB:
          type: number
Command line used for generation

docker run --rm -v ${PWD}:/local swaggerapi/swagger-codegen-cli-v3:3.0.2 generate -i /local/swagger.yaml -l typescript-angular -o /local/ts-angular

Suggest a fix/enhancement

The generated model is

import { BigDecimal } from './bigDecimal';

export interface Response { 
    propA?: BigDecimal;
    propB?: BigDecimal;
}

And it is invalid (bigDecimal is not defined). The generated model should be:

export interface Response { 
    propA?: number;
    propB?: number;
}

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4