openapi-typescript-codegen icon indicating copy to clipboard operation
openapi-typescript-codegen copied to clipboard

Type conversion of model

Open Natsumeaiovo opened this issue 1 year ago • 1 comments

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;
};

Natsumeaiovo avatar Oct 23 '24 11:10 Natsumeaiovo

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

mrlubos avatar Oct 23 '24 12:10 mrlubos