ferdikoomen / openapi-typescript-codegen

NodeJS library that generates Typescript or Javascript clients based on the OpenAPI specification
MIT License
2.94k stars 521 forks source link

Type conversion of model #2259

Open Natsumeaiovo opened 4 days ago

Natsumeaiovo commented 4 days ago

Describe the bug The backend parameters are of type Long, while the API generated by OpenAPI is of type number. Reading Long type data and converting it to number type may result in accuracy loss. How to map Long type to string or bigint type when generating API in OpenAPI?

backend:

public class Question implements Serializable {

    @TableId(type = IdType.ASSIGN_ID)
    private Long id;

    private Date createTime;

    @TableLogic
    private Integer isDelete;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;
}

Code generated using OpenAPI:

export type Question = {
    createTime?: string;
    id?: number;
    isDelete?: number;
    updateTime?: string;
};
mrlubos commented 4 days ago

Hi @Natsumeaiovo, please see the README in this repository. If you'd like to open an issue, you're welcome to do so in Hey API