swagger-api / swagger-api/swagger-codegen

Typescript-node - Should use the `async` keyword on methods returning a promise

Open
#9,235 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

I installed swagger-codegen@2 on a mac to make sure that typescript-node was included as a language. When generating a Typescript-node API there is no need to include bluebird as a dependency. Also the async methods that return a promise should be defined with the async keyword. For example:

public methodName(): Promise<type>
should be
public async methodName(): Promise<type>

Description
Swagger-codegen version

V2.4.1

Command line used for generation

swagger-codegen generate -i swagger.json -l typescript-node

Steps to reproduce

Any typescript-node generation

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start from the typescript-node generation entry point used by swagger-codegen generate -i swagger.json -l typescript-node, then inspect the templates and dependency declarations that produce the generated API. Generate a sample API to verify that bluebird is no longer required and that promise-returning methods use async.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.