mean-expert-official / loopback-sdk-builder

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

SDK Builder fails when hiding username from User model extension #478

Open mittinatten opened 7 years ago

mittinatten commented 7 years ago

What type of issue are you creating?

What version of this module are you using?

Please add a description for your issue:

I get an error for both 2.0.10 and 2.1.0-rc.13.4 but not 2.1.0-rc.9, where the SDK fails to build with the following error message:

...
Generating: ..../src/app/shared/sdk/models/Person.ts
readline.js:982
            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 <anonymous> (..../node_modules/@mean-expert/loopback-sdk-builder/node_modules/ejs/lib/ejs.js:242:14), <anonymous>:30:204)
    at eval (eval at <anonymous> (..../node_modules/@mean-expert/loopback-sdk-builder/node_modules/ejs/lib/ejs.js:242:14), <anonymous>:30:2632)
...

I managed to pin down what triggers the error in my code: I extend the Loopback User model with a model called Person. If I add the line "hidden": ["username"] to the model configuration, building the SDK fails, otherwise not. If I hide email instead, building the SDK succeeds.

jonathan-casarrubias commented 7 years ago

hi @mittinatten thanks for reporting,

It seems there is a missing validation in there, I'll verify this as soon as I can.

Cheers Jon

gsyjdcg commented 7 years ago

+1

Paulillo16 commented 7 years ago

+1

ajescobar commented 7 years ago

I have the same problem!!!!