-
Notifications
You must be signed in to change notification settings - Fork 4
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
Remove SimpleSchema dependency #4
Comments
Yes if we have to make arguments checks let's just use I would leave something like this: ValidationError = class extends Meteor.Error {
constructor(errors, message = 'Validation Failed') {
check(arguments, /* rule */);
super(ValidationError.ERROR_CODE, message, errors);
this.errors = errors;
}
};
ValidationError.ERROR_CODE = 'validation-error'; |
@jagi actually, can we just make But this comes first. |
To clarify, my main problem with check is:
So having a standard format would fix all of this up immediately. |
Hmmm I think that using "schema check" for ValidationError arguments is too heavy. It's kinda wired to use SS to check arguments of ValidationError class. If there are invalid arguments it will also throw ValidationError instance. I know that |
Oh I know, I'm changing it. I'm just saying why I would prefer to use just one pattern, rather than using check's format in one place, and a different one in others. |
Ok good! |
Oh you've already made changes :) hehe I was 1 minute to late with my PR :) |
Yeah I also took the opportunity to clean up a bunch of other junk. Thanks for the PR, anyway :P |
:) |
I agree with this change because the circular dependency already complicates things a bit (simple-schema also depends on validation-error). But I honestly would prefer to not have the check dependency either. For this tiny amount of argument checking, why not just write it out? Otherwise someone using SimpleSchema or Astronomy needs an additional dependency they aren't using. (Granted check will likely be a dep anyway since a million other packages use it, but I can envision a future in which that is not the case.) |
I think basically every single part of core meteor uses check, so the future in which you can avoid having it in your app at all is far away indeed. Perhaps if we were trying to publish to npm it could be removed - thoughts? |
I would also remove it. As I think about the |
Yes, but in all core Meteor packages - Mongo, Accounts, etc. |
Yes you're right in fact I'm using |
My goal is to release the next SimpleSchema as a pure node package without strong deps on anything in Meteor. Using separate Meteor package or dependency injection for Tracker reactivity. I don't know yet if I will be able to achieve this. Currently in order to do that, I would have to replicate the validation-error package as a pure node package anyway, so I could take out the But anyway that is why I suggest removing the check dep, because I'd like to use it in non-Meteor apps. It's true though that you'd end up needing some lightweight checker, but BTW, we have also published a pure Node version of Of course if every pkg is using a different lightweight checker library, then it's not really lightweight anymore. :) I guess that is an argument in favor of us all adopting TypeScript, which I think we will. |
It would actually be really nice if ddp-server package would just send any thrown error that has |
I think it would make a lot of sense to make the main code for |
Agree |
It's just for argument checking, so we don't really need it.
The text was updated successfully, but these errors were encountered: