-
Notifications
You must be signed in to change notification settings - Fork 82
Closed
Labels
Description
Description/Steps to reproduce
Scoped methods representing the relations of the models are not generated if models are namespaced. The generator will skip them because it is not able to resolve the corresponding (namespaced) target model. Please consider the following, failing test case (can be directly copy pasted into the services.spec.js):
describe('$resource generated with namespaceModels:true and ' +
'namespaceDelimiter:_ expose scope methods', function() {
var $injector, Product;
before(function() {
return given.servicesForLoopBackApp(
{
models: {
Product: {
properties: {
name: 'string',
price: { type: 'number' },
},
options: {
relations: {
category: {
model: 'Category',
type: 'belongsTo',
},
},
},
},
Category: {
properties: {
name: 'string',
},
}
},
name: 'lbServices',
namespaceModels: true,
namespaceDelimiter: '_',
})
.then(function(createInjector) {
$injector = createInjector();
Product = $injector.get('lbServices_Product');
});
});
it('exposes scope methods', function(){
expect(Product).to.have.property('category').that.has.property('create');
});
});Expected result
I'd expect the namespaced resources to to have accessors to their scope methods analogous to non-namespaced models.
Fix
I created a PR which fixes the behavior #293
Additional information
Node: darwin x64 8.8.1
SDK version: 3.4.0
Reactions are currently unavailable