mean-expert-official / loopback-sdk-builder

Tool for auto-generating Software Development Kits (SDKs) for LoopBack
Other
399 stars 175 forks source link

Cannot create Model #498

Open sarpaykent opened 7 years ago

sarpaykent commented 7 years ago

What type of issue are you creating?

What version of this module are you using?

Write other if any:

When I'm trying to create sdk with " ./node_modules/.bin/lb-sdk server/server.js client/src/app/shared/sdk -d ng2w eb -i enabled"

Generating: \client\src\app\shared\sdk/models/Developer.ts
readline.js:1015
            throw err;
            ^

TypeError: ejs:5
    3| declare var Object: any;
    4| export interface <%- modelName %>Interface {
 >> 5| <%- buildModelProperties(model, true) %>
    6| }
    7|
    8| export class <%- modelName %> implements <%- modelName %>Interface {

Cannot read property 'type' of undefined
    at Object.buildModelProperties (\node_modules\@mean-expert\loopback-sdk-builder\lib\angular2\index.js:390:40)
    at eval (eval at exports.compile (\node_modules\@mean-expert\loopback-sdk-builder\node_modules\ejs\lib\ejs.js:242:14), <anonymous>:30:204)
    at eval (eval at exports.compile (\node_modules\@mean-expert\loopback-sdk-builder\node_modules\ejs\lib\ejs.js:242:14), <anonymous>:30:2632)
    at \node_modules\@mean-expert\loopback-sdk-builder\node_modules\ejs\lib\ejs.js:255:15
    at Object.exports.render (\node_modules\@mean-expert\loopback-sdk-builder\node_modules\ejs\lib\ejs.js:293:13)
    at schema.forEach.config (\node_modules\@mean-expert\loopback-sdk-builder\lib\angular2\index.js:335:13)
    at Array.forEach (native)
    at Object.generate [as angular2] (\node_modules\@mean-expert\loopback-sdk-builder\lib\angular2\index.js:327:10)
    at runGenerator (\node_modules\@mean-expert\loopback-sdk-builder\bin\lb-sdk:163:31)
    at rl.question (\node_modules\@mean-expert\loopback-sdk-builder\bin\lb-sdk:144:13)
    at Interface._onLine (readline.js:276:5)
    at Interface._line (readline.js:625:8)
    at Interface._ttyWrite (readline.js:904:14)
    at ReadStream.onkeypress (readline.js:157:10)
    at emitTwo (events.js:125:13)
    at ReadStream.emit (events.js:213:7)

My model JSON:

{
  "name": "Developer",
  "base": "User",
  "excludeBaseProperties": [
    "realm", "username"
  ],
  "idInjection": true,
  "restrictResetPasswordTokenScope": true,
  "emailVerificationRequired": false,
  "validations": [],
  "relations": {},
  "strict": true,
  "acls": [
    {
      "principalType": "ROLE",
      "principalId": "$everyone",
      "accessType": "READ",
      "permission": "ALLOW"
    }
  ],
  "properties": {
    "username": {
      "type": "string",
      "required": true,
      "index": true,
      "id": true
    },
    "description": {
      "default": "",
      "type": "string"
    },
    "enabled": {
      "default": true,
      "type": "Boolean"
    },
    "locked": {
      "default": false,
      "type": "Boolean"
    }
  },
  "mixins": {
    "TimeStamp" : true
  },
  "methods": []
}
sarpaykent commented 7 years ago

It looks like duplicate of #478