Пример #1
0
        private void AddChildScope(ConditionalScope scope)
        {
            if (ConditionalChildren == null)
            {
                ConditionalChildren = new List <ConditionalScope>();
            }

            ConditionalChildren.Add(scope);
        }
Пример #2
0
        protected void ValidateConditionalChildren(JsonToken token, object value, int depth)
        {
            if (!ConditionalChildren.IsNullOrEmpty())
            {
                for (int i = 0; i < ConditionalChildren.Count; i++)
                {
                    ConditionalScope conditionalScope = ConditionalChildren[i];

                    conditionalScope.EvaluateToken(token, value, depth);
                    Context.Validator.ReturnScopeToCache(conditionalScope);
                }
            }
        }
        protected override void OnConditionalScopeValidated(ConditionalScope conditionalScope)
        {
            if (ShouldValidateUnevaluated())
            {
                if (!conditionalScope.EvaluatedSchemas.IsNullOrEmpty())
                {
                    foreach (KeyValuePair <int, UnevaluatedContext> unevaluatedScope in _unevaluatedScopes)
                    {
                        UnevaluatedContext context = unevaluatedScope.Value;

                        if (!context.Evaluated && !context.ValidScopes.IsNullOrEmpty())
                        {
                            foreach (JSchema validScopes in context.ValidScopes)
                            {
                                if (conditionalScope.EvaluatedSchemas.Contains(validScopes))
                                {
                                    context.Evaluated = true;
                                }
                            }
                        }
                    }
                }
            }
        }
 protected virtual void OnConditionalScopeValidated(ConditionalScope conditionalScope)
 {
 }