You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
using TypeScript generated APIs I run into:
Cannot read properties of undefined (reading 'normalizeMediaType')
TypeError: Cannot read properties of undefined (reading 'normalizeMediaType')
at getPreferredMediaType ([...]\models\ObjectSerializer.ts:269:54)
when looking at the code, the problem seems pretty obvious. as far as I am concerned, this does not exist in a static method. that is the point of being static, isn't it? having no reference to an object.
openapi-generator version
7.10.0 of org.openapitools:openapi-generator-maven-plugin. using the typescript generator.
OpenAPI declaration file content or url
not relevant imo. can be reproduced using petstore API.
Generation Details
in the build section of pom.xml the following is contained.
bbortt
changed the title
[BUG] Cannot read properties of undefined (reading 'normalizeMediaType')
[BUG][typescript] Cannot read properties of undefined (reading 'normalizeMediaType')
Nov 28, 2024
bbortt
added a commit
to bbortt/openapi-generator
that referenced
this issue
Nov 28, 2024
…cript object serializer
accessing `normalizeMediaType` should be done static in `ObjectSerializer`, as described
in OpenAPITools#20201.
fix applies only to the `typescript` generator.
… serializer (#20202)
accessing `normalizeMediaType` should be done static in `ObjectSerializer`, as described
in #20201.
fix applies only to the `typescript` generator.
Bug Report Checklist
Description
using TypeScript generated APIs I run into:
when looking at the code, the problem seems pretty obvious. as far as I am concerned,
this
does not exist in astatic
method. that is the point of being static, isn't it? having no reference to an object.openapi-generator version
7.10.0 of
org.openapitools:openapi-generator-maven-plugin
. using thetypescript
generator.OpenAPI declaration file content or url
not relevant imo. can be reproduced using petstore API.
Generation Details
in the
build
section ofpom.xml
the following is contained.Steps to reproduce
if really required I can create a reproducer. but the bug is pretty logical imo.
I have applied the proposed fix locally, recompiled the library (without regenerating the API) and everything went just fine.
Related issues/PRs
Suggest a fix
update the
ObjectSerializer.ts
to this:instead of
The text was updated successfully, but these errors were encountered: