Beispiel #1
0
        private bool AssertScopeComplete(SchemaScope schemaScope, JsonToken token, object?value, int depth)
        {
            switch (schemaScope.Complete)
            {
            case CompleteState.Incomplete:
                // the schema scope that the conditional scope depends on may not be complete because it has be re-ordered
                // schema scope will be at the same depth at the conditional so evaluate it immediately
                schemaScope.Complete = CompleteState.Completing;
                schemaScope.EvaluateToken(token, value, depth);

#if DEBUG
                if (schemaScope.Complete != CompleteState.Completed)
                {
                    throw new Exception("Schema scope {0} is not complete.".FormatWith(CultureInfo.InvariantCulture, schemaScope.DebugId));
                }
#endif
                return(true);

            case CompleteState.Completing:
                return(false);

            case CompleteState.Completed:
                return(true);

            default:
                throw new InvalidOperationException("Unexpected complete state.");
            }
        }
Beispiel #2
0
        private void AssertScopeComplete(SchemaScope schemaScope, JsonToken token, object value, int depth)
        {
            // the schema scope that the conditional scope depends on may not be complete because it has be re-ordered
            // schema scope will be at the same depth at the conditional so evaluate it immediately
            if (!schemaScope.Complete)
            {
                schemaScope.EvaluateToken(token, value, depth);

#if DEBUG
                if (!schemaScope.Complete)
                {
                    throw new Exception("Schema scope {0} is not complete.".FormatWith(CultureInfo.InvariantCulture, schemaScope.DebugId));
                }
#endif
            }
        }