Home IKeywordHandler Interface
IKeywordHandler Interface
Cancel

IKeywordHandler Interface

Namespace: Json.Schema

Inheritance: IKeywordHandler

Defines the contract for handling custom JSON Schema keywords, including validation, subschema construction, and evaluation logic.

Remarks

Implementations of this interface enable extensibility for JSON Schema processing by supporting custom keyword behaviors. Each handler is responsible for validating keyword values, building any required subschemas, and evaluating the keyword during schema validation. This interface is intended for advanced scenarios

Properties

NameTypeSummary
NamestringGets the name of the handled keyword.

Methods

BuildSubschemas(KeywordData keyword, BuildContext context)

Builds and registers subschemas based on the specified keyword data within the provided build context.

Declaration

1
public abstract void BuildSubschemas(KeywordData keyword, BuildContext context)
ParameterTypeDescription
keywordKeywordDataThe keyword data used to determine which subschemas to build. Cannot be null.
contextBuildContextThe context in which subschemas are constructed and registered. Cannot be null.

Evaluate(KeywordData keyword, EvaluationContext context)

Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.

Declaration

1
public abstract KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)
ParameterTypeDescription
keywordKeywordDataThe keyword data to be evaluated. Cannot be null.
contextEvaluationContextThe context in which the keyword evaluation is performed. Cannot be null.

Returns

A KeywordEvaluation object containing the results of the evaluation.

ValidateKeywordValue(JsonElement value)

Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.

Declaration

1
public abstract object ValidateKeywordValue(JsonElement value)
ParameterTypeDescription
valueJsonElementThe JSON element to validate and convert. Represents the value to be checked for keyword compliance.

Returns

An object that is shared with the other methods. This object is saved to Json.Schema.KeywordData.Value.

Contents