JsonSchemaValidator

org.llm4s.eval.dataset.JsonSchemaValidator

Lightweight structural validator for JSON values against a JSON Schema subset.

Only the following schema keywords are recognised; all others are silently ignored:

  • type — checks the JSON type of the value (object, array, string, number, boolean, null); unknown type strings are skipped
  • required — when the value is a JSON object, verifies that each named key is present
  • properties — when the value is a JSON object, recursively validates each listed property against its sub-schema

This is intentionally '''not''' a full JSON Schema implementation (no if/then/else, anyOf, $ref, etc.). It is sufficient for validating the structure of Example inputs and outputs in evaluation datasets.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def validate(value: Value, schema: Value): Either[List[String], Unit]

Validates value against schema, collecting all errors before returning.

Validates value against schema, collecting all errors before returning.

Value parameters

schema

a ujson.Obj JSON Schema fragment; non-object schemas are accepted as-is

value

the JSON value to validate

Attributes

Returns

Right(()) if validation passes, Left(errors) with one message per violation