swagger-api / swagger-api/swagger-codegen
[typescript-axios] Bug generating
Open
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
Swagger-codegen version
3.0.42-20230216
Swagger declaration file content or url
...
{
"OrganizationUnitDto": {
"type": "object",
"properties": {
"id": {
"type": "object",
"additionalProperties": { },
"nullable": true,
"readOnly": true
},
"children": {
"type": "array",
"items": {
"$ref": "#/components/schemas/OrganizationUnitDto"
},
"nullable": true
}
},
"additionalProperties": false
},
}
Suggest a fix/enhancement
when schema [schema-name ] recursive $refs=self [schema-name ] generated code
import schemaName from 'schema-name'
// not import self
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
Start with the TypeScript-Axios generation path and reproduce the issue using the OrganizationUnitDto schema shown in the report, including its recursive self-reference. Trace how schema imports are selected; done means the generated code does not import the schema from itself while preserving the recursive type reference.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100