swagger-api / swagger-api/swagger-codegen
`file` mapping in Typescript generators
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
As discovered by @TiFu TS generators do not have a consistent mapping for file at the moment:
The issue you noticed is caused by the typemapping from file => Buffer. This mapping was added to TypeScriptNodeCodegen.java almost a year ago. Somehow the ts node tests still contain the previous any type mapping defined in AbstractTypeScriptCodegen.java.
Another thing I noticed is, that TypeScriptNodeCodegen uses typeMapping.put("file", "Buffer");, whereas AbstratcTypeScriptCodegen uses typeMapping.put("File", "any"); (note the capitalization of file)
Ref: https://github.com/swagger-api/swagger-codegen/pull/4264#issuecomment-277345595
Swagger-codegen version
2.3.0
Related issues
https://github.com/swagger-api/swagger-codegen/pull/4264#issuecomment-277345595
Suggest a Fix
We'll need to review and fix the mapping for file
cc @Vrolijkx
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
Compare the file mappings in TypeScriptNodeCodegen.java and AbstractTypeScriptCodegen.java, including the capitalization difference and the existing TypeScript node tests. Review the related pull request comment, then run the TypeScript node tests after making the mappings consistent and verifying that the expected file type is used.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100