ValidateWithGenericSchema
Description
Validates a JSON payload against a generic schema definition.The method dynamically constructs a JSON Schema using metadata provided through GenericSchema and SchemaProperty.
GenericSchema
SchemaProperty
Parameters
jsonText
string
schema
properties
List
Supported Property Rules
Each SchemaProperty supports:
PropertyName – JSON property name
PropertyName
DataType – string, number, integer, object
DataType
number
integer
object
IsRequired – Marks field as required
IsRequired
MinLength, MaxLength – For strings
MinLength
MaxLength
Pattern – Regex validation
Pattern
Format – JSON Schema formats (email, date-time, etc.)
Format
MinValue, MaxValue – Numeric constraints
MinValue
MaxValue
EnumValues – Comma-separated allowed values
EnumValues
Returns
IsValid
bool
ErrorCount
int
ErrorMessages
Example
{ "name": "John", "age": 30 }
If age violates a numeric range, the validator will return:
age
IsValid = false ErrorCount = 1 ErrorMessages = "Integer 30 is greater than maximum value 25"
ValidateJson
Validates a JSON payload against a standard JSON Schema provided as a string.
schemaJson
Use Case
API request validation
Schema-based data ingestion
Contract validation with external systems