Open JulienUsson opened 4 years ago
👍 Thanks for opening this issue! 🏷 I have applied any labels matching special text in your issue.
The team will review the labels and make any necessary changes.
Hi, I've encountered the same issue. Patching modules/openapi-generator/src/main/resources/typescript-fetch/modelGeneric.mustache#L99 resolves the problem, but I'm not 100% confident in the solution. Here is the patch:
{{#isArrayModel}}
{{#arrayModelType}}
// This is a manual change to the template in an attempt to fix:
// https://github.com/OpenAPITools/openapi-generator/issues/5264
if ((json === undefined) || (json === null)) {
return json;
}
return (json as Array<any>).map(value => {{arrayModelType}}FromJSON(value, nullToUndefined));
{{/arrayModelType}}
{{^arrayModelType}}
return json;
{{/arrayModelType}}
{{/isArrayModel}}
{{^isArrayModel}}
return json;
{{/isArrayModel}}
Bug Report Checklist
Description
ModelPropertyNaming is ignored for list of reference item. Snake case properties are not converted to camel case properties in runtime but the types are correct (in snake case).
openapi-generator version
v4.2.3
OpenAPI declaration file content or url
Command line used for generation
docker run --rm -u $(id -u ${USER}):$(id -g ${USER}) -v ${PWD}:/local -w /local openapitools/openapi-generator-cli:v4.2.3 generate --enable-post-process-file --generate-alias-as-model --generator-name typescript-fetch -i ./openapi.yaml -o ./ --model-package types --api-package api -p withSeparateModelsAndApi=true
Actuel output
Expected output
Related issues/PRs
I found none.