-
Notifications
You must be signed in to change notification settings - Fork 1.2k
add allowArray to relations' 'create' remoteMethod #2947
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
66883ec to
8357390
Compare
accepted from model's remoteMethodaccepted from model's remoteMethod
|
@slnode test please |
8357390 to
9d0bb18
Compare
lib/model.js
Outdated
| accepts: { arg: 'data', type: 'object', model: toModelName, http: { source: 'body' }}, | ||
| // retrieve original remoteMethod's arguments, so it properly inherits options | ||
| accepts: retrieveRemoteMethodInformation.call(this, toModelName, 'create') ? | ||
| retrieveRemoteMethodInformation.call(this, toModelName, 'create').accepts[0] : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bajtos do you think it make sense to try to inherit the accept from the remoteClass, or its too much trouble for too little benefits?
we could also simply just add allowArray here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case, I would simply copy the allowArray flag. Relation methods are similar but not the same as original DAO methods. In the future, their REST API may diverge, in which case we would not want to share argument metadata.
|
@slnode test please |
1 similar comment
|
@slnode test please |
3052828 to
0f4bd37
Compare
accepted from model's remoteMethod| .end(function(err, result) { | ||
| if (err) return done(err); | ||
| expect(result.body).to.have.property('id'); | ||
| expect(result.body).to.have.property('title', aPost.title); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this be changed to :
expect(result.body.title).to.eql(aPost.title)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
has discussion with @gunjpan decided to keep it the same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Please resolve conflicts and rebase.
this is needed because we added allowArray flag to persisted model's remoteMethod, but when relations try to rebuild such methods, it does not carry over such flags
0f4bd37 to
fa7cb92
Compare
connected to #2928
Description
this is a problem where relation's model's remoteMethods are rebuilt (not inherited).
Eg lets say
POST /book(book.create) has flag allowArrayPOST /Author/id/Bookwill rebuildremoteMethodper relation typeRelated issues
Checklist
guide
this is needed because we added allowArray flag to persisted model's
remoteMethod, but when relations try to rebuild such methods, it does
not carry over such flags
Update 16/11/16:
Update 17/11/16: