Open Hoyci opened 6 months ago
I'm creating a documentation for my API, but when I create a Response t.Object like this: t.Object({ user: t.Object({ id: t.String(), email: t.String(), createdAt: t.Date(), updatedAt: t.Date() }) })
t.Object({ user: t.Object({ id: t.String(), email: t.String(), createdAt: t.Date(), updatedAt: t.Date() }) })
createdAt and updatedAt is transformed for this on the OpenAPI Document "createdAt": { "anyOf": [ { "type": "Date" }, { "format": "date", "default": "2024-05-16T23:05:28.064Z", "type": "string" }, { "format": "date-time", "default": "2024-05-16T23:05:28.064Z", "type": "string" } ] }, "updatedAt": { "anyOf": [ { "type": "Date" }, { "format": "date", "default": "2024-05-16T23:05:28.065Z", "type": "string" }, { "format": "date-time", "default": "2024-05-16T23:05:28.065Z", "type": "string" } ] } },
"createdAt": { "anyOf": [ { "type": "Date" }, { "format": "date", "default": "2024-05-16T23:05:28.064Z", "type": "string" }, { "format": "date-time", "default": "2024-05-16T23:05:28.064Z", "type": "string" } ] }, "updatedAt": { "anyOf": [ { "type": "Date" }, { "format": "date", "default": "2024-05-16T23:05:28.065Z", "type": "string" }, { "format": "date-time", "default": "2024-05-16T23:05:28.065Z", "type": "string" } ] } },
And to work well needs to be like:
"createdAt": { "format": "date", "default": "2024-05-16T23:05:28.065Z", "type": "string" }
Is this an error in my code or a bug on elysia-swagger?
Facing this issues as well.
The swagger Date types are still generated as date | string; Note the lowercase date, which is invalid.
Date
date | string;
I'm creating a documentation for my API, but when I create a Response t.Object like this:
t.Object({ user: t.Object({ id: t.String(), email: t.String(), createdAt: t.Date(), updatedAt: t.Date() }) })
createdAt and updatedAt is transformed for this on the OpenAPI Document
"createdAt": { "anyOf": [ { "type": "Date" }, { "format": "date", "default": "2024-05-16T23:05:28.064Z", "type": "string" }, { "format": "date-time", "default": "2024-05-16T23:05:28.064Z", "type": "string" } ] }, "updatedAt": { "anyOf": [ { "type": "Date" }, { "format": "date", "default": "2024-05-16T23:05:28.065Z", "type": "string" }, { "format": "date-time", "default": "2024-05-16T23:05:28.065Z", "type": "string" } ] } },
And to work well needs to be like:
"createdAt": { "format": "date", "default": "2024-05-16T23:05:28.065Z", "type": "string" }
Is this an error in my code or a bug on elysia-swagger?