Esempio n. 1
0
        public override Result DoMatch(JToken token, IJsonValidationContext context)
        {
            DynamicContext con     = (DynamicContext)context;
            CompareContext compare = con.SelectToken(selector);

            try
            {
                JsonConstraint constraint = factory(compare).Constraint.Optimize();
                //TODO: As of now we only support a single token due to the conversion that happens below.
                return(new LazyConstraintResult(this, compare, constraint.DoMatch(token, context)));
            }
            catch (Exception ex)
            {
                //TODO: As of now we only support a single token due to the conversion that happens below.
                return(new LazyConstraintResult(this, compare, new ConstraintExceptionResult(this, token, ex)));
            }
        }