meteor / meteor/validated-method

Wanted: validated-publication

Open
#51 3 comments 3 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
193
Forks
29
PR merge metrics
No merged PRs in 30d

Description

Doesn't really belong on this project but not sure where else to put it.

But it would be nice to accomplish something that has a similar list [benefits](https://github.com/meteor/validated-method#benefits-of-validatedmethod) that validate method has:
- Have an object that represents your publication. Refer to it through JavaScript scope rather than by a magic string name.
- Built-in validation of arguments through aldeed:simple-schema, or roll your own argument validation.
- Provide access to the same query that will be used inside the publication. Because of [reasons described here](http://guide.meteor.com/data-loading.html#publication-behavior-with-arguments) I often times find myself copying and pasting a lot of the database queries.
- Or even better than the above be able to do a single call that returns the subscription handler like before, but also, an already fetched list of the documents found. And have it be reactive. Ideally I could write in a ReactMeteorData container something like the following:

```
export default createContainer(() => {
const { handle, data } = publicationObject.subscribeAndFetch();
return {
loading: !handle.ready(),
data: data,
}
},
```

When it comes down to it I feel like I copy the same pattern pretty often: subscribe, pass along the handle.ready() info, do the same query on the collection as happened in the publication, and pass along that data.

And oh yeah, obviously be able to handle compsite publications.

Would this be bad form to have something like this? It seems like it would be a great nice to have, just like validated-method is wonderful.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing the validated-method benefits linked in the issue and the described publication and subscription patterns. The proposal has no named files or tests; work would first require agreeing on scope and an API for validation, query reuse, fetched reactive data, and composite publications.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.