You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tried using SimpleSchema.oneOf with sub schemas (I know, bad idea considering the kindly written note that it's experimental).
It seems like it's only using the last schema fed in for validation, as can be seen with the following snippets :
Snippet 1 :
varsampleSchema=newSimpleSchema({property : SimpleSchema.oneOf(newSimpleSchema({subProperty : String,}),newSimpleSchema({subProperty : Number,}))})sampleSchema.validate({property : {subProperty : 1,}})// OKsampleSchema.validate({property : {subProperty : 'stringy string',}})// ClientError: Sub property must be of type Number
Snippet 2 :
varsampleSchema=newSimpleSchema({property : SimpleSchema.oneOf(newSimpleSchema({subProperty : Number,}),newSimpleSchema({subProperty : String,}))})sampleSchema.validate({property : {subProperty : 'stringy string',}})sampleSchema.validate({property : {subProperty : 1,}})// ClientError: Sub property must be of type String
The text was updated successfully, but these errors were encountered:
Tried using SimpleSchema.oneOf with sub schemas (I know, bad idea considering the kindly written note that it's experimental).
It seems like it's only using the last schema fed in for validation, as can be seen with the following snippets :
Snippet 1 :
Snippet 2 :
The text was updated successfully, but these errors were encountered: