swagger-api / swagger-api/swagger-codegen

[typescript-node] petstore example won't build since v2.2.3

Open
#8,120 2 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

Description

npm run build will not work on the pet store example since v2.2.3. I'm running into a similar issue on my generated client as well.

Swagger-codegen version

2.2.3

Swagger declaration file content or url

Successful build with v2.2.3:

~/swagger-codegen/samples/client/petstore/typescript-node/npm:(HEAD detached at v2.2.3)$ npm i && npm run build

> @swagger/angular2-typescript-petstore@0.0.1-SNAPSHOT.201605241654 postinstall /Users/aedwards/swagger-codegen/samples/client/petstore/typescript-node/npm
> typings install


├── bluebird@3.3.4
├─┬ request
│ └── form-data
├── core-js (ambient)
└── node (ambient)


> @swagger/angular2-typescript-petstore@0.0.1-SNAPSHOT.201605241654 build /Users/aedwards/swagger-codegen/samples/client/petstore/typescript-node/npm
> tsc

~/swagger-codegen/samples/client/petstore/typescript-node/npm:(HEAD detached at v2.2.3)$

Failing build for v2.3.0:

~/swagger-codegen/samples/client/petstore/typescript-node/npm:(HEAD detached at v2.3.0)$ npm i && npm run build
@swagger/angular2-typescript-petstore@0.0.1 /Users/aedwards/swagger-codegen/samples/client/petstore/typescript-node/npm
├── @types/bluebird@3.5.20
├─┬ @types/request@2.47.0
│ ├── @types/caseless@0.12.1
│ ├── @types/form-data@2.2.1
│ ├── @types/node@10.0.2
│ └── @types/tough-cookie@2.3.2
├── bluebird@3.5.1
├─┬ request@2.85.0
│ ├── aws-sign2@0.7.0
│ ├── aws4@1.7.0
│ ├── caseless@0.12.0
│ ├─┬ combined-stream@1.0.6
│ │ └── delayed-stream@1.0.0
│ ├── extend@3.0.1
│ ├── forever-agent@0.6.1
│ ├─┬ form-data@2.3.2
│ │ └── asynckit@0.4.0
│ ├─┬ har-validator@5.0.3
│ │ ├─┬ ajv@5.5.2
│ │ │ ├── co@4.6.0
│ │ │ ├── fast-deep-equal@1.1.0
│ │ │ ├── fast-json-stable-stringify@2.0.0
│ │ │ └── json-schema-traverse@0.3.1
│ │ └── har-schema@2.0.0
│ ├─┬ hawk@6.0.2
│ │ ├── boom@4.3.1
│ │ ├─┬ cryptiles@3.1.2
│ │ │ └── boom@5.2.0
│ │ ├── hoek@4.2.1
│ │ └── sntp@2.1.0
│ ├─┬ http-signature@1.2.0
│ │ ├── assert-plus@1.0.0
│ │ ├─┬ jsprim@1.4.1
│ │ │ ├── extsprintf@1.3.0
│ │ │ ├── json-schema@0.2.3
│ │ │ └─┬ verror@1.10.0
│ │ │   └── core-util-is@1.0.2
│ │ └─┬ sshpk@1.14.1
│ │   ├── asn1@0.2.3
│ │   ├── bcrypt-pbkdf@1.0.1
│ │   ├── dashdash@1.14.1
│ │   ├── ecc-jsbn@0.1.1
│ │   ├── getpass@0.1.7
│ │   ├── jsbn@0.1.1
│ │   └── tweetnacl@0.14.5
│ ├── is-typedarray@1.0.0
│ ├── isstream@0.1.2
│ ├── json-stringify-safe@5.0.1
│ ├─┬ mime-types@2.1.18
│ │ └── mime-db@1.33.0
│ ├── oauth-sign@0.8.2
│ ├── performance-now@2.1.0
│ ├── qs@6.5.1
│ ├── safe-buffer@5.1.2
│ ├── stringstream@0.0.5
│ ├─┬ tough-cookie@2.3.4
│ │ └── punycode@1.4.1
│ ├── tunnel-agent@0.6.0
│ └── uuid@3.2.1
└── typescript@2.8.3


> @swagger/angular2-typescript-petstore@0.0.1 build /Users/aedwards/swagger-codegen/samples/client/petstore/typescript-node/npm
> tsc

api.ts(431,12): error TS2564: Property 'username' has no initializer and is not definitely assigned in the constructor.
api.ts(432,12): error TS2564: Property 'password' has no initializer and is not definitely assigned in the constructor.
api.ts(441,12): error TS2564: Property 'apiKey' has no initializer and is not definitely assigned in the constructor.
api.ts(456,12): error TS2564: Property 'accessToken' has no initializer and is not definitely assigned in the constructor.
api.ts(466,12): error TS2564: Property 'username' has no initializer and is not definitely assigned in the constructor.
api.ts(467,12): error TS2564: Property 'password' has no initializer and is not definitely assigned in the constructor.
node_modules/@types/node/index.d.ts(130,5): error TS2300: Duplicate identifier 'resolve'.
...
...
...
typings/main/definitions/request/index.d.ts(304,10): error TS2300: Duplicate identifier 'main'.

npm ERR! Darwin 15.6.0
npm ERR! argv "/Users/aedwards/.nvm/versions/node/v6.3.1/bin/node" "/Users/aedwards/.nvm/versions/node/v6.3.1/bin/npm" "run" "build"
npm ERR! node v6.3.1
npm ERR! npm  v3.10.3
npm ERR! code ELIFECYCLE
npm ERR! @swagger/angular2-typescript-petstore@0.0.1 build: `tsc`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the @swagger/angular2-typescript-petstore@0.0.1 build script 'tsc'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the @swagger/angular2-typescript-petstore package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     tsc
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs @swagger/angular2-typescript-petstore
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls @swagger/angular2-typescript-petstore
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/aedwards/swagger-codegen/samples/client/petstore/typescript-node/npm/npm-debug.log
Command line used for generation

npm i && npm run build

Steps to reproduce
  1. git checkout tags/v2.3.0
  2. cd samples/client/petstore/typescript-node/npm
  3. npm i && npm run build

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 in samples/client/petstore/typescript-node/npm and run npm i && npm run build at v2.3.0 to reproduce the failure. Inspect the generated api.ts errors and the package's TypeScript dependency and typings setup. Done means the petstore TypeScript Node example builds successfully without the reported TypeScript errors.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.