Merge pull request #3540 from lehni/fix/isStatic-method-settings
Do not add isStatic properties to method settings
This commit is contained in:
commit
2ebe38b4d5
|
@ -273,7 +273,7 @@ Registry.prototype._defineRemoteMethods = function(ModelCtor, methods) {
|
||||||
|
|
||||||
if (typeof meta.isStatic !== 'boolean') {
|
if (typeof meta.isStatic !== 'boolean') {
|
||||||
key = isStatic ? key : m[1];
|
key = isStatic ? key : m[1];
|
||||||
meta.isStatic = isStatic;
|
meta = Object.assign({}, meta, {isStatic});
|
||||||
} else if (meta.isStatic && m) {
|
} else if (meta.isStatic && m) {
|
||||||
throw new Error(g.f('Remoting metadata for %s.%s {{"isStatic"}} does ' +
|
throw new Error(g.f('Remoting metadata for %s.%s {{"isStatic"}} does ' +
|
||||||
'not match new method name-based style.', ModelCtor.modelName, key));
|
'not match new method name-based style.', ModelCtor.modelName, key));
|
||||||
|
|
|
@ -1032,4 +1032,18 @@ describe.onServer('Remote Methods', function() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('Create Model with remote methods from JSON description', function() {
|
||||||
|
it('does not add isStatic properties to the method settings', function() {
|
||||||
|
const app = loopback();
|
||||||
|
const Foo = app.registry.createModel({
|
||||||
|
name: 'Foo',
|
||||||
|
methods: {
|
||||||
|
staticMethod: {},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
app.model(Foo);
|
||||||
|
expect(app.models.Foo.settings.methods.staticMethod).to.eql({});
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue