Open
Description
The following definitions
"definitions": {
"BaseEntityWithoutId": {
"required": [],
"properties": {
"createdAt": {
"type": "string",
"description": "The creation date of the object."
},
"updatedAt": {
"type": "string",
"description": "The last update date of the object."
},
"version": {
"type": "integer",
"description": "The current version of the object."
}
}
},
"BaseEntity": {
"required": [
"id"
],
"properties": {
"id": {
"type": "integer",
"description": "The auto-generated object id."
}
},
"allOf": [
{
"$ref": "#/definitions/BaseEntityWithoutId"
}
]
}
}
Generates the following file:
export interface BaseEntityWithoutId {
/** The creation date of the object. */
createdAt?: string;
/** The last update date of the object. */
updatedAt?: string;
/** The current version of the object. */
version?: number;
}
export type BaseEntity = { id: number } & { id: number };
Removing the 'id' from required fixes it slightly and gives the following output:
export interface BaseEntityWithoutId {
/** The creation date of the object. */
createdAt?: string;
/** The last update date of the object. */
updatedAt?: string;
/** The current version of the object. */
version?: number;
}
export type BaseEntity = BaseEntityWithoutId & { id?: number };
Am I doing something wrong or is this a bug?