swagger-api / swagger-api/swagger-codegen
[Javascript] Circular dependency import error
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
The model generated from a class with circular dependency comes with an
import from self, generating the error "has already declared".
Swagger-codegen version
swagger-codegen-cli-2.4.0
Command line used for generation
`java -Dapis -Dmodels -DmodelDocs=false -DmodelTests=false -DapiTests=false -DapiDocs=false -jar {jarPath} generate -l javascript -c ${config} -o {folderPath} -i {url}
config : {
"sourceFolder": ".",
"useES6": true,
"usePromises": true,
"emitModelMethods": true
}
Steps to reproduce
1 - Run the command line
2 - Import any class with circular dependency model
Related issues/PRs
https://github.com/swagger-api/swagger-codegen/issues/7543
https://github.com/swagger-api/swagger-codegen/pull/6069
https://github.com/swagger-api/swagger-codegen/pull/6069
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Run the supplied swagger-codegen command with a model containing a circular dependency and inspect the generated JavaScript imports. Read related issue 7543 and pull request 6069 for prior context; done means generation no longer produces a self-import or the reported “has already declared” error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- devtools, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 32/100