-
-
Notifications
You must be signed in to change notification settings - Fork 272
Open
Labels
bug 🔥Something isn't workingSomething isn't working
Milestone
Description
Description
Even with dates switched off, transformers are created for the dates and the dates are “passed” through the transformers.
At the end they are strings again. The types do not have the type Date.
The problem is that I want to have a string like this for date: 2024-10-10. However, I get 2024-10-10T00:00:00.000Z.
This is the server response:
"date": "2024-10-10",
This happens because of:
export const XXXModelResponseTransformer: XXXModelResponseTransformer =
(data) => {
if (data?.date) {
data.date = new Date(data.date);
}
return data;
};
My config:
export default defineConfig({
input: "../../specifications/service.yaml",
output: {
path: "src/generated/client/service",
format: "prettier",
lint: "eslint",
},
plugins: [
"@hey-api/schemas",
{
asClass: true,
name: "@hey-api/services",
},
{
enums: "typescript",
name: "@hey-api/types",
},
{
dates: false,
name: "@hey-api/transformers",
},
"@tanstack/react-query",
],
client: "@hey-api/client-fetch",
});
Reproducible example or configuration
No response
OpenAPI specification (optional)
e.g.:
orderDate:
type: string
format: date
System information (optional)
"@hey-api/client-fetch": "0.4.2",
"@hey-api/openapi-ts": "0.54.4",
Metadata
Metadata
Assignees
Labels
bug 🔥Something isn't workingSomething isn't working