-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
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
typescript-fetch generated code BaseAPI class doesn't compile #9459
Comments
I have raised a PR with my suggested changes here: |
The problem is still there and even the brew one doesn't compile installing the swagger-codegen v 2.4.6.
The configuration variable has not always an assignment in the constructor.
The name variable has clearly no instantiation nor assignment. So the api.ts doesn't compile. |
Unfortunately, looking at the top contributors here, none of them seem to be committing this year :( I fear my PR to fix this will not get merged for a while (as it's sat there for a while already!). Any advice as to whom I could tag to get this merged? |
I've run into this problem today. Anyone know anything about the status on this? |
Ended up using https://github.com/OpenAPITools/openapi-generator instead, but you could pull my fork and build locally to get it to work |
I'd been locked to 5.1.1 due to this bug, but just upgraded to 5.4.0 and was able to compile TS without errors. |
@nathanstitt , are you talking about openapi-generator? Or am I missing something. The latest swagger-codegen seems to be 3.0.34 https://github.com/swagger-api/swagger-codegen/releases/tag/v3.0.34 |
Description
The generated BaseAPI has a non-nullable field
Configuration
, but it is conditionally assigned in the constructor, resulting in a TS2564 Property 'configuration' has no initializer and is not definitely assigned in the constructor.Also, in the
RequiredError
below, the value name has the same issue. It seems to use a semicolon instead of an = symbolSwagger-codegen version
2.3.1 using version 1.0.44 parser (due to the bundled parser not following refs correctly as has been detailed on another issue)
Swagger declaration file content or url
Any yaml produces it, but here's an abridged version for referenced
If you post the code inline, please wrap it with
Command line used for generation
maven plugin
Steps to reproduce
maven install
, then try and use a typescript compiler or see the generated outputRelated issues/PRs
Nope
Suggest a fix/enhancement
Within the following file:
https://github.com/swagger-api/swagger-codegen/blob/master/modules/swagger-codegen/src/main/resources/typescript-fetch/api.mustache,
Either make configuration nullable , or provide a default one.
Change the colon to an equals in RequiredError.
The text was updated successfully, but these errors were encountered: