Looking for guidance on validating an object using Meteor-Collection2. Let's explore this further in the code snippet below:
// Object structure to validate
// const obj = {
// name: 'Test',
// active: true,
// }
Test.schemaObj = {
someOtherName: {
type: String, // Different from obj variable
},
testType: {
type: Object,
// Define rules for validation within this object
},
// Inside the object: {
// type: String,
// required: true,
//},
// Inside the object: {
// type: Boolean,
// required: true,
//},
};
The required is automatically set to true if not defined.
The objective is to specify all necessary keys that the object must have and their respective validation rules. A grasp of array of objects is there, just unsure about the syntax for object validation.
Pursued documentation and stack-overflow but could not find a clear online resource showing the syntax explicitly.
Fairly certain something basic has been overlooked due to being new to this, seeking assistance from someone knowledgeable in this area.