Deprecate https://github.com/aldeed/meteor-simple-schema and replace with https://github.com/aldeed/node-simple-schema
We've tested a few times and there were some issues, but it's time to revisit, as we need this in place for our react components to use for validation, and also in some new registry requirements we're working on. This would also allow us to deprecate meteor autoform as soon as the remaining dashboard blaze templates are converted.
fwiw I played with this recently and the main issue I ran into was that node-simple-schema does not support things like [MyCustomSchema] which we have a fair amount of.
I've gone ahead and replaced all instances of type: [String] or any other arrays that are built like that in our current code base.
See my branch spencer-node-simple-schema-update-schemas
Current issues I'm running into:
it appears that the node version does not support our index property
Error: Invalid definition for userId field: "index" is not a supported property
at /Users/sn/dev/reaction-dev/node_modules/simpl-schema/dist/SimpleSchema.js:965:13
at Function._.each._.forEach (/Users/sn/dev/reaction-dev/node_modules/underscore/underscore.js:158:9)
at checkAndScrubDefinition (/Users/sn/dev/reaction-dev/node_modules/simpl-schema/dist/SimpleSchema.js:963:24)
at /Users/sn/dev/reaction-dev/node_modules/simpl-schema/dist/SimpleSchema.js:498:9
at Function._.each._.forEach (/Users/sn/dev/reaction-dev/node_modules/underscore/underscore.js:158:9)
at SimpleSchema.extend (/Users/sn/dev/reaction-dev/node_modules/simpl-schema/dist/SimpleSchema.js:486:28)
at new SimpleSchema (/Users/sn/dev/reaction-dev/node_modules/simpl-schema/dist/SimpleSchema.js:107:10)
at meteorInstall.lib.collections.schemas.accounts.js (lib/collections/schemas/accounts.js:74:25)
at fileEvaluate (packages/modules-runtime.js:333:9)
at require (packages/modules-runtime.js:228:16)
=> Exited with code: 1
From @mikemurray, we need to be aware of how our Validation works with this. I've not looked into this at all yet.
I've not had a chance to update main.js yet either.
Because the app crashes immediately, I can't consider this to be an entire list of issues we'll run into when completing the swap, but it's definitely a good start.
For 1.5.0 we're going to launch with registerSchema in order to fix the load order issues were having right now. @kieckhafer thinks we may need to do this even with the node version, that seems like a reasonable argument to make after my time digging around in it.
Related #3034
PR #3053 will be the registerSchema updates. It's working well as is with a few test schemas, just need to make sure all schemas are registered.
@aaronjudd @spencern Let me know if you want me to tackle this and #3034. I'm going to try getting back into the reaction codebase a bit.
@aldeed that'd be awesome! happy to have you. (added you back to collaborators to make life easy)
Would love that @aldeed
I've got a branch that has a decent start (updates all arrays in our schema to fit the node-simple-schema model) if you want a head start.
https://github.com/reactioncommerce/reaction/tree/spencer-node-simple-schema-update-schemas
@spencern Thanks, I will start from there
Most helpful comment
@aaronjudd @spencern Let me know if you want me to tackle this and #3034. I'm going to try getting back into the reaction codebase a bit.