meteor / meteor/validated-method

Method with no parameters will error

Open
#39 11 comments 1 reaction 1 assignee Claimed by @stubailo View on GitHub
enhancement
Dominant language
JavaScript
Stars
193
Forks
29
PR merge metrics
No merged PRs in 30d

Description

So as per the Meteor guide, if you use `mdg:validated-method` to create a method that takes no parameters, you still must provide a validator, like so:

``` js
validate: new SimpleSchema({}).validator()
```

But there is an issue then if you then call that method with no parameters at all. e.g. calling

``` js
Collection.methods.methodName.call()
```

will error. As the validator, expects an object as the first parameter. Obviously just changing this to:

``` js
Collection.methods.methodName.call({})
```

fixes the issue, but it's a little awkward.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.