confluent-kafka-dotnet
Show / Hide Table of Contents

Class ValidationRules

Helpers shared by the per-format inline validation rule walkers.

Inheritance
object
ValidationRules
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Confluent.SchemaRegistry
Assembly: Confluent.SchemaRegistry.dll
Syntax
public static class ValidationRules

Fields

RulesProp

The schema property (Avro) / keyword (JSON Schema) that holds inline validation rules.

Declaration
public const string RulesProp = "confluent:rules"
Field Value
Type Description
string

Methods

Evaluate(IValidationRuleExecutor, ValidationRule, object, object, string, IList<ValidationRuleError>)

Evaluates one inline validation rule, adding a ValidationRuleError to violations when it fails. A rule that throws is itself recorded as a violation so the walk can continue; a rule resolving to something other than a bool or string is a programming error and propagates.

Declaration
public static Task Evaluate(IValidationRuleExecutor executor, ValidationRule rule, object schema, object value, string path, IList<ValidationRuleError> violations)
Parameters
Type Name Description
IValidationRuleExecutor executor
ValidationRule rule
object schema
object value
string path
IList<ValidationRuleError> violations
Returns
Type Description
Task

Parse(string)

Parses a "confluent:rules" property value from its JSON representation. Missing or malformed values yield an empty list.

Declaration
public static IList<ValidationRule> Parse(string json)
Parameters
Type Name Description
string json
Returns
Type Description
IList<ValidationRule>

ThrowIfFailed(IList<ValidationRuleError>)

Throws a single exception aggregating every violation found, or returns when there are none.

Declaration
public static void ThrowIfFailed(IList<ValidationRuleError> violations)
Parameters
Type Name Description
IList<ValidationRuleError> violations
In this article