We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
transformer
Even with dates switched off, transformers are created for the dates and the dates are “passed” through the transformers.
transformers
At the end they are strings again. The types do not have the type Date.
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.
2024-10-10
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", });
No response
e.g.:
orderDate: type: string format: date
"@hey-api/client-fetch": "0.4.2", "@hey-api/openapi-ts": "0.54.4",
The text was updated successfully, but these errors were encountered:
That's a good feedback. I will change it as you describe, though I wonder why you use the plugin at all if you don't want to transform dates?
I don't fully understand this. How do you end up with a string if the transformer gives you a date?
Sorry, something went wrong.
Yes, I turned off the transformer yesterday and realized that this fixed my problem without losing other functions.
I thought the transformer transformed more than just dates. I wanted to be as typed as possible.
No branches or pull requests
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 get2024-10-10T00:00:00.000Z
.This is the server response:
This happens because of:
My config:
Reproducible example or configuration
No response
OpenAPI specification (optional)
e.g.:
System information (optional)
"@hey-api/client-fetch": "0.4.2",
"@hey-api/openapi-ts": "0.54.4",
The text was updated successfully, but these errors were encountered: