Newtonsoft.Json.JsonValidatingReader.ValidatePropertyName C# (CSharp) Method

ValidatePropertyName() private method

private ValidatePropertyName ( JsonSchemaModel schema ) : void
schema Newtonsoft.Json.Schema.JsonSchemaModel
return void
        private void ValidatePropertyName(JsonSchemaModel schema)
        {
            if (schema == null)
            {
                return;
            }

            string propertyName = Convert.ToString(_reader.Value, CultureInfo.InvariantCulture);

            if (_currentScope.RequiredProperties.ContainsKey(propertyName))
            {
                _currentScope.RequiredProperties[propertyName] = true;
            }

            if (!schema.AllowAdditionalProperties)
            {
                bool propertyDefinied = IsPropertyDefinied(schema, propertyName);

                if (!propertyDefinied)
                {
                    RaiseError("Property '{0}' has not been defined and the schema does not allow additional properties.".FormatWith(CultureInfo.InvariantCulture, propertyName), schema);
                }
            }

            _currentScope.CurrentPropertyName = propertyName;
        }