Show / Hide Table of Contents

Class Validator

The conizi schema validator is used to validate a JSON message against the assigned Schema. The validator is build around the C# library Newtonsoft.Json.Schema.

Inheritance
System.Object
Validator
Namespace: Conizi.Model.Core.Tools
Assembly: Conizi.Model.Core.dll
Syntax
public class Validator : object
Remarks

You can use this Newtonsoft.Json.Schema for free in a small context, to validate a huge amount of messages, you must buy a license.

Methods

ParseModel(String)

Parse the JSON message and try to extract the model

Declaration
public static Type ParseModel(string jsonMessage)
Parameters
Type Name Description
System.String jsonMessage

JSON message as string

Returns
Type Description
Type

Type of the used model/class

RegisterJsonSchemaLicense(String)

Register a JsonSchema License if available

Declaration
public static void RegisterJsonSchemaLicense(string license)
Parameters
Type Name Description
System.String license

Newtonsoft.Json.Schema license as string

ValidateSchema(String, out IList<String>)

Validate a JSON message vs the specific JSON Schema. The method tries to extract the schema from the message.

Declaration
public static ValidationResult ValidateSchema(string jsonMessage, out IList<string> validationErrors)
Parameters
Type Name Description
System.String jsonMessage

JSON message as string

IList<System.String> validationErrors

Possible validation errors as list of strings

Returns
Type Description
ValidationResult

ValidationResult

ValidateSchema(Type, String, out IList<String>)

Validate a JSON message vs the specific JSON Schema.

Declaration
public static ValidationResult ValidateSchema(Type model, string jsonMessage, out IList<string> validationErrors)
Parameters
Type Name Description
Type model

Type of the used C# model

System.String jsonMessage

JSON message as string

IList<System.String> validationErrors

Possible validation errors as list of strings

Returns
Type Description
ValidationResult

ValidationResult

ValidateSchema<TModel>(String, out IList<String>)

Validate a JSON message vs the specific JSON Schema by type.

Declaration
public static ValidationResult ValidateSchema<TModel>(string jsonMessage, out IList<string> validationErrors)
Parameters
Type Name Description
System.String jsonMessage

JSON message as string

IList<System.String> validationErrors

Possible validation errors as list of strings

Returns
Type Description
ValidationResult

ValidationResult

Type Parameters
Name Description
TModel
Back to top Generated by DocFX