Class PayloadValidator

java.lang.Object
com.babelqueue.schema.PayloadValidator

public final class PayloadValidator extends Object
Validates a message's data block against a per-URN JSON Schema (ADR-0024). A hand-rolled subset of Draft-07 (zero dependencies, GR-7) whose verdicts match the Go, PHP, Python and Node validators and babelqueue-registry's compat linter. Supported keywords: type, required, properties, additionalProperties, items, enum, const, minLength, minimum; unknown keywords are ignored. It works on the decoded Map/List/scalar structures the codec produces (numbers are Long/BigInteger/Double).
  • Method Details

    • validate

      public static String validate(Map<String,Object> schema, Object value)
      The first violation of value against schema as "<json-pointer>: <reason>", or null when it conforms.
      Parameters:
      schema - the decoded JSON Schema for the data block
      value - the decoded value to validate
      Returns:
      the first violation, or null when valid