Which one should I use aldeed/meteor-simple-schema or aldeed/simple-schema-js?


#1

Which one should I use aldeed/meteor-simple-schema or aldeed/simple-schema-js ?
I am having problems with custom validation messages.


#2

aldeed/simple-schema-js is recommended over the atmosphere version.

Can you give specifics on what issues you are having?


#3

I am using meteor/mdg:validated-method and I think it requires aldeed/meteor-simple-schema
but I am not sure.

Can you help me with this one please ?


#4

I use aldeed:simple-schema together with mdg:validated-method.

I have a file for each one of my collections with the declaration of the collection and the schema declaration for that collection right underneath. I also found attaching the schema to the collection really handy.

export const Orders = new Mongo.Collection('orders');
Orders.schema = new SimpleSchema({ ... });

I wouldn’t attach your messages to the one schema, though, so other schema’s can also use them. I have a separate file that sets translated error messages for all schema’s like so:

SimpleSchema.messages({
		required: TAPi18n.__('schema-validation.required'),
		...
});

Hope this helps.