As no data received from the client should be trusted, I want to validate that the posted result.data conforms to the questionnaire.
A straight-forward way would be to use json schema for that, although it is still a draft.
However, it wouldn't be capable of validating all of my constraints: questions that are only conditionally required (by use of VisibleIf), or use custom validation, like
JavaScript{panel.DateStart} <= {panel.DateEnd}
Also, it would require to keep a json schema up to date with the questionnaire.
So, I was considering to use a server-side javascript engine to load and run SurveyJS and just validate the result on the server. The result of a failed validation might be to direct the submitted result to a separate list, for further investigation.
Does that sound like a good idea, or are there serious pitfalls? Or, is there a better solution for this that I just missed?