-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
[BUG] [typescript-fetch] Circular import generated #6140
Comments
👍 Thanks for opening this issue! The team will review the labels and make any necessary changes. |
Note that even with direct imports from the individual model files (as you suggested), it's possible to get circular reference if actual models in api-spec have such a circular reference. |
True, though I guess that would sort of be expected at that point. Do you think this is worth fixing for this case? It only seems to cause warnings and not errors as long as the dependencies aren't truly circular (i.e. actually circularly referential), so I suppose I could live with just ignoring the warnings, but it also seems like a pretty small and easy fix? |
Yeah I don't see how such a change can hurt in any way. Would you want to make a PR with the fix? |
Hello, any update on this ? Living with a warning is a bit painful... |
Hi, I also stumbled upon this today. Are there any plans to address this warning? Thanks for the update and all the help. |
I'm sure the maintainers would welcome a PR. |
templates based off of OpenAPITools#6140 and @ajaska closes OpenAPITools#6140
I've just created a PR to fix this issue based on the work of @ajaska , and you can try it using this docker container |
templates based off of OpenAPITools#6140 and @ajaska closes OpenAPITools#6140
Bug Report Checklist
Description
The typescript-fetch generator is generating a circular import. In my provided reproducible example, it's
models/index.ts -> models/HTTPValidationError.ts -> models/index.ts
The actual code is:
This produces some annoying warning messages but doesn't seem to actually break the code.
openapi-generator version
4.3.0
OpenAPI declaration file content or url
Click to expand
Command line used for generation
openapi-generator generate -g typescript-fetch -i test-input.json -o api-client
Steps to reproduce
Run command line with provided input.
Related issues/PRs
Nope
Suggest a fix
I'm pretty sure this can be fixed by re-working the import statements in
modelGeneric.mustache
andmodelOneOf.mustache
. Instead of importing from./
, it should be possible to import directly from the thing you're importing. For example, in the code above, it could import from./ValidationError
instead of./
.A diff might look like (forgive me, I'm not entirely familiar with mustache syntax):
The text was updated successfully, but these errors were encountered: