Skip to content

Error trying to generate the REST API with a camel case project name #10

Open
@Grendel61

Description

@Grendel61

Hi, I think I found a small error/feature in the REST API generator.

I was having a lot of problems with a Typescript error popping up during the REST API generation process.

conv-rest-api generate api -c projectName -f org1.projectName.config.json
[conv-rest-api] Removing previously generated app (packages/server)
[conv-rest-api] Generating stub folder 
[conv-rest-api] Exiting packages folder...
/Users/username/GitHub/projectName
[conv-rest-api] Compiling new app...
[conv-rest-api] Bootstrapping...
[conv-rest-api] Adding chaincode(s)...
(node:39035) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'getClassOrThrow' of undefined
    at /Users/username/.nvm/versions/node/v8.15.1/lib/node_modules/@worldsibu/conv-rest-api/dist/utils/reflectionUtils.js:152:41
    at new Promise (<anonymous>)
    at Object.getClassMethods (/Users/username/.nvm/versions/node/v8.15.1/lib/node_modules/@worldsibu/conv-rest-api/dist/utils/reflectionUtils.js:146:16)
    at ApiGenerator.<anonymous> (/Users/username/.nvm/versions/node/v8.15.1/lib/node_modules/@worldsibu/conv-rest-api/dist/apiGenerator.js:152:70)
    at step (/Users/username/.nvm/versions/node/v8.15.1/lib/node_modules/@worldsibu/conv-rest-api/node_modules/tslib/tslib.js:136:27)
    at Object.next (/Users/username/.nvm/versions/node/v8.15.1/lib/node_modules/@worldsibu/conv-rest-api/node_modules/tslib/tslib.js:117:57)
    at /Users/username/.nvm/versions/node/v8.15.1/lib/node_modules/@worldsibu/conv-rest-api/node_modules/tslib/tslib.js:110:75
    at new Promise (<anonymous>)
    at Object.__awaiter (/Users/username/.nvm/versions/node/v8.15.1/lib/node_modules/@worldsibu/conv-rest-api/node_modules/tslib/tslib.js:106:16)
    at ApiGenerator.getParams (/Users/username/.nvm/versions/node/v8.15.1/lib/node_modules/@worldsibu/conv-rest-api/dist/apiGenerator.js:144:24)
(node:39035) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 4)
(node:39035) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I originally had generated the project with conv new projectName in camel case, then when I ran the api generator conv-rest-api generate api -c projectName -f org1.projectName.config.json I received the error above.

I thought the error was in my model files or the controller files, but it was something simpler.

When I regenerated the project name without camel case, the api generator worked.
That wasn't my first attempt 😃

I was on a Macbook, and I should know better than to use camel case in file and directory names. You may want to force lowercase.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions