Define remote methods via model settings/config - #1366
Conversation
There was a problem hiding this comment.
I decided to report a warning instead of throwing an exception, because what if somebody was already using the "methods" option and implemented a solution similar to this patch? Throwing an exception would break backwards-compatibility for that case.
However, if you @ritch think I am too cautious and it's ok to throw an error, then I'll rework this part.
|
@mrfelton thanks for the original contribution. We appreciate you moving this forward 👍 👍 👍 |
|
no worries... Will be great to see this finally committed in some form. I'm for the backwards compatibility option of providing a warning rather than throwing an exception, since I am using my earlier path on several systems :) |
Process `settings.methods` and `config.methods` as a key-value map
where the key is the method name and the value is an object describing
the method in the format expected by strong-remoting.
Example: a static method `Model.create`
"methods": {
"create": {
"isStatic": true,
"accepts": {
"arg": "data", "type": "Car",
"http": { "source": "body" }
},
"returns": { "arg": "data", "type": "Car", "root": true }
}
}
This patch is based on the code proposed by @mrfelton in #1163.
35db170 to
f93b69e
Compare
|
@ritch LGTY now? |
|
LGTM 👍 |
Define remote methods via model settings/config
|
This should be reflected in the docs! |
Good catch, /cc @crandmck |
Process
settings.methodsandconfig.methodsas a key-value mapwhere the key is the method name and the value is an object describing
the method in the format expected by strong-remoting.
Example: a static method
Model.createThis patch is a reworked version of #1163 and fixes #209 .
/to @ritch please review
/cc @mrfelton