confluent-kafka-dotnet
Show / Hide Table of Contents

Class JsonUtils

JSON Schema utilities

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

Methods

Transform(RuleContext, JsonSchema, JsonSchema, string, object, IFieldTransform)

Declaration
public static Task<object> Transform(RuleContext ctx, JsonSchema rootSchema, JsonSchema schema, string path, object message, IFieldTransform fieldTransform)
Parameters
Type Name Description
RuleContext ctx
JsonSchema rootSchema
JsonSchema schema
string path
object message
IFieldTransform fieldTransform
Returns
Type Description
Task<object>

Validate(IValidationRuleExecutor, JsonSchema, object, bool)

Walks the message against the schema, evaluating every inline "confluent:rules" constraint encountered and collecting all failures. Read-only — the message is not modified.

Two kinds of rules are evaluated:

  • Object-level ("confluent:rules" on an object schema) — this is the object.
  • Property-level ("confluent:rules" on a property schema) — this is the property value. Honors the skip-on-null contract: a property that is absent or null does not have its rules invoked.

Failures are returned with their location, rooted at "$" to match the JVM client (e.g. $.addr.zip, $.tags[3]). The walk continues after each failure unless failFast is set.

Declaration
public static Task<IList<ValidationRuleError>> Validate(IValidationRuleExecutor executor, JsonSchema rootSchema, object message, bool failFast)
Parameters
Type Name Description
IValidationRuleExecutor executor
JsonSchema rootSchema
object message
bool failFast
Returns
Type Description
Task<IList<ValidationRuleError>>
In this article