allow batch create for persisted models#2879
Conversation
2d78f04 to
b41c339
Compare
|
@bajtos PTAL |
| accepts: { | ||
| arg: 'data', type: 'object', model: typeName, | ||
| description: 'Model instance data', | ||
| description: 'Model instance data', allowArray: true, |
There was a problem hiding this comment.
It's a good practice to keep related things close together and unrelated things apart. IMO, allowArray and description are rather unrelated.
Please move allowArray closer to type/model, e.g. on the previous line.
| expect(callbackSpy).to.have.been.calledWith(TestModel.sharedClass, 'findOne'); | ||
| }); | ||
|
|
||
| describe('batch operations', function() { |
There was a problem hiding this comment.
I am proposing to move this new test into describe.onServer('Remote Methods') block as describe('Model.create(data, callback'). I think it would be worth adding two tests - one sending an object, the other sending an array. That way the tests make it clear that both variants are supported.
| it('creates model', function(done) { | ||
| var anObject = { first: 'June' }; | ||
| request(app) | ||
| .post('/users') |
There was a problem hiding this comment.
i noticed the other test cases in this describe is using the method itself instead of going thru strong-remoting
like User.destroyAll(....), instead of POST /users/destroyAll, but that wouldnt be able to verify our scenario that strong-remoting rejects the array. should i add comments to describe why its different?
There was a problem hiding this comment.
destroyAll is not exposed via REST.
should i add comments to describe why its different?
yes please, that would be helpful
| it('creates model', function(done) { | ||
| var anObject = { first: 'June' }; | ||
| request(app) | ||
| .post('/users') |
There was a problem hiding this comment.
destroyAll is not exposed via REST.
should i add comments to describe why its different?
yes please, that would be helpful
In strong-remoting 3.x, we have stricken the coercion of inputs methods that are expecting an Object will nolonger accept an array as input, to preserve backwards compatibility we have added flag allowArray in remote arguments, which would accept an array of objects
9a260a4 to
5252fba
Compare
|
updated comments
travis wouldnt pass unless strong-remoting is published |
|
@slnode test please |
connect to strongloop-internal/scrum-loopback#1138
Description
In strong-remoting 3.x, we have stricken the coercion of inputs
methods that are expecting an Object will nolonger accept an array
as input, to preserve backwards compatibility we have added flag
allowArray in remote arguments, which would accept an array of objects
Related issues
Checklist
guide
List of other remoteMethods in persistedModel that receives a
datawithtype:objecti looked at them and dont think they should support batch