Description
When generating the transformers for bigints, the generated output is wrong if the input is a primitive array.
Generated output:
data.primitiveArray = data.primitiveArray.map((item: any) => {
BigInt(item.toString());
return item;
});
Fixed generated output should return the transformed value, not the original:
data.primitiveArray = data.primitiveArray.map((item: any) => {
return BigInt(item.toString());
});
If the input is an array of objects, the transform works correctly
data.images = data.images.map((item: any) =>
imageSchemaResponseTransformer(item),
);
const imageSchemaResponseTransformer = (data: any) => {
data.id = BigInt(data.id.toString());
return data;
};
Reproducible example or configuration
package version
"@hey-api/openapi-ts": "0.95.0"
config
import { defineConfig } from "@hey-api/openapi-ts";
export default defineConfig({
input: {
path: process.env.API_DOCS_PATH,
},
output: {
path: "src/lib/api/client",
postProcess: ["prettier", "biome:lint"],
},
plugins: [
"@tanstack/react-query",
"zod",
{
dates: false,
bigInt: true,
name: "@hey-api/transformers",
},
{
name: "@hey-api/sdk",
transformer: true,
},
],
});
OpenAPI specification (optional)
No response
System information (optional)
No response
Description
When generating the transformers for bigints, the generated output is wrong if the input is a primitive array.
Generated output:
Fixed generated output should return the transformed value, not the original:
If the input is an array of objects, the transform works correctly
Reproducible example or configuration
package version
config
OpenAPI specification (optional)
No response
System information (optional)
No response