Login to follow
JSONSchemaValidator

JSONSchemaValidator (ODC)

Stable version 0.1.1 (Compatible with ODC)
Uploaded on 19 Jan by EONE TECHNOLOGIES PRIVATE LIMITED
JSONSchemaValidator

JSONSchemaValidator (ODC)

Documentation
0.1.1

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.


Parameters

NameTypeDescription
jsonTextstringJSON string to validate
schemaGenericSchemaRoot-level schema definition
propertiesListProperty-level schema definitions


Supported Property Rules

Each SchemaProperty supports:

  • PropertyName – JSON property name

  • DataTypestring, number, integer, object

  • IsRequired – Marks field as required

  • MinLength, MaxLength – For strings

  • Pattern – Regex validation

  • Format – JSON Schema formats (email, date-time, etc.)

  • MinValue, MaxValue – Numeric constraints

  • EnumValues – Comma-separated allowed values

Returns

FieldTypeDescription
IsValidboolIndicates whether JSON is valid
ErrorCountintNumber of validation errors
ErrorMessagesstringConcatenated error messages


Example

{
  "name": "John",
  "age": 30
}

If age violates a numeric range, the validator will return:

IsValid = false
ErrorCount = 1
ErrorMessages = "Integer 30 is greater than maximum value 25"

ValidateJson


Description

Validates a JSON payload against a standard JSON Schema provided as a string.


Parameters

NameTypeDescription
jsonTextstringJSON payload to validate
schemaJsonstringJSON Schema definition


Returns

FieldTypeDescription
IsValidboolValidation result
ErrorCountintNumber of errors
ErrorMessagesstringCombined error messages


Use Case

  • API request validation

  • Schema-based data ingestion

  • Contract validation with external systems