json_validator_ext
json_validator_ext · Validate JSONB values against JSON Schema using Rust and pgrx
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 101239 | json_validator_ext | json_validator_ext | 0.0.0 | FEAT | Unknown | Rust |
PostgreSQL · 13, 14, 15, 16, 17, 18
Usage
Sources:
json_validator_ext validates PostgreSQL jsonb values against JSON Schema. It supplies a compact operator for constraints, an equivalent function, detailed error reporting, and a per-backend LRU cache for compiled schemas.
Core Workflow
Install the extension, then put the JSON instance on the left and its schema on the right of @@:
Objects and Configuration
jsonb @@ jsonbreturns whether the left-hand instance satisfies the right-hand schema.validate_json_schema(jsonb, jsonb)takes the schema first and the instance second.explain_json_schema_errors(jsonb, jsonb)returns a text array with instance paths and validation messages.json_validator.cache_sizecontrols compiled schemas cached per backend. It defaults to 100, accepts 1 through 1000, and is a superuser-settable runtime parameter.
Invalid schema definitions make the boolean APIs return false; use the diagnostic function to distinguish an invalid schema from an invalid instance. The control file marks the extension superuser-only, untrusted, and non-relocatable. The canonical extension and package name is json_validator_ext, although the README heading calls the project pg_json_schema; version 0.0.0 is an early API, so pin and regression-test the reviewed build and JSON Schema behavior before relying on it for integrity constraints.