public JsonConstraintDescription(JsonConstraint source, string format)
        {
            this.source = source;
            this.format = format;

            type = source.GetType();
        }
Ejemplo n.º 2
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)));
            }
        }
Ejemplo n.º 3
0
 public ConstraintResult(JsonConstraint constraint, JToken token, bool value)
 {
     Constraint = constraint;
     Token = token;
     Value = value;
 }
Ejemplo n.º 4
0
 public NotJsonConstraint(JsonConstraint constraint)
 {
     Constraint = constraint;
 }
 public BasicJsonRuleDescription(string alias, string selector, JsonConstraint constraint)
 {
     this.alias = alias;
     this.selector = selector;
     this.constraint = constraint;
 }
Ejemplo n.º 6
0
 public NotJsonConstraint(JsonConstraint constraint)
 {
     Constraint = constraint;
 }
Ejemplo n.º 7
0
 public BasicJsonRule(FieldSelector selector, string alias, CapturedConstraint constraint)
 {
     this.Selector = selector;
     this.Alias = alias;
     this.constraint = constraint.Constraint.Optimize();
 }
Ejemplo n.º 8
0
 public CapturedConstraint(JsonConstraint constraint, string context = "")
 {
     Constraint = constraint;
     Constraint.ContextInfo = context;
 }
Ejemplo n.º 9
0
 public CapturedConstraint Capture(JsonConstraint constraint)
 {
     return new CapturedConstraint(constraint, context);
 }