jsonschema
jsonschema : JSON Schema validation functions for PostgreSQL
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 2760 | jsonschema | jsonschema | 0.1.9 |
FEAT | MIT | Rust |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
| --s-d-r | No | Yes | No | Yes | yes | no |
| Relationships | |
|---|---|
| See Also | pgbson pgjq jsquery pg_jsonschema pg_projection jsonb_plperl documentdb jsonb_plperlu jsonb_plpython3u mongo_fdw |
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PIGSTY | 0.1.9 |
18 17 16 15 14 | jsonschema |
- |
| RPM | PIGSTY | 0.1.9 |
18 17 16 15 14 | jsonschema_$v |
- |
| DEB | PIGSTY | 0.1.9 |
18 17 16 15 14 | postgresql-$v-jsonschema |
- |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PIGSTY 0.1.9 | PIGSTY 0.1.9 | PIGSTY 0.1.9 | PIGSTY 0.1.9 | PIGSTY 0.1.9 |
| el8.aarch64 | PIGSTY 0.1.9 | PIGSTY 0.1.9 | PIGSTY 0.1.9 | PIGSTY 0.1.9 | PIGSTY 0.1.9 |
| el9.x86_64 | PIGSTY 0.1.9 | PIGSTY 0.1.9 | PIGSTY 0.1.9 | PIGSTY 0.1.9 | PIGSTY 0.1.9 |
| el9.aarch64 | PIGSTY 0.1.9 | PIGSTY 0.1.9 | PIGSTY 0.1.9 | PIGSTY 0.1.9 | PIGSTY 0.1.9 |
| el10.x86_64 | PIGSTY 0.1.9 | PIGSTY 0.1.9 | PIGSTY 0.1.9 | PIGSTY 0.1.9 | PIGSTY 0.1.9 |
| el10.aarch64 | PIGSTY 0.1.9 | PIGSTY 0.1.9 | PIGSTY 0.1.9 | PIGSTY 0.1.9 | PIGSTY 0.1.9 |
| d12.x86_64 | PIGSTY 0.1.9 | PIGSTY 0.1.9 | PIGSTY 0.1.9 | PIGSTY 0.1.9 | PIGSTY 0.1.9 |
| d12.aarch64 | PIGSTY 0.1.9 | PIGSTY 0.1.9 | PIGSTY 0.1.9 | PIGSTY 0.1.9 | PIGSTY 0.1.9 |
| d13.x86_64 | PIGSTY 0.1.9 | PIGSTY 0.1.9 | PIGSTY 0.1.9 | PIGSTY 0.1.9 | PIGSTY 0.1.9 |
| d13.aarch64 | PIGSTY 0.1.9 | PIGSTY 0.1.9 | PIGSTY 0.1.9 | PIGSTY 0.1.9 | PIGSTY 0.1.9 |
| u22.x86_64 | PIGSTY 0.1.9 | PIGSTY 0.1.9 | PIGSTY 0.1.9 | PIGSTY 0.1.9 | PIGSTY 0.1.9 |
| u22.aarch64 | PIGSTY 0.1.9 | PIGSTY 0.1.9 | PIGSTY 0.1.9 | PIGSTY 0.1.9 | PIGSTY 0.1.9 |
| u24.x86_64 | PIGSTY 0.1.9 | PIGSTY 0.1.9 | PIGSTY 0.1.9 | PIGSTY 0.1.9 | PIGSTY 0.1.9 |
| u24.aarch64 | PIGSTY 0.1.9 | PIGSTY 0.1.9 | PIGSTY 0.1.9 | PIGSTY 0.1.9 | PIGSTY 0.1.9 |
| u26.x86_64 | PIGSTY 0.1.9 | PIGSTY 0.1.9 | PIGSTY 0.1.9 | PIGSTY 0.1.9 | PIGSTY 0.1.9 |
| u26.aarch64 | PIGSTY 0.1.9 | PIGSTY 0.1.9 | PIGSTY 0.1.9 | PIGSTY 0.1.9 | PIGSTY 0.1.9 |
Source
github.com/theory/pg-jsonschema-boon
jsonschema-0.1.9.tar.gz
Install
Make sure PGDG and PIGSTY repo available:
Install this extension with pig:
Create this extension with:
Usage
Sources:
jsonschema validates JSON and JSONB values against JSON Schema inside PostgreSQL. It is the theory/pg-jsonschema-boon extension and is distinct from Supabase pg_jsonschema, although it provides compatibility wrappers named json_matches_schema() and jsonb_matches_schema().
The extension supports JSON Schema draft 4, draft 6, draft 7, draft 2019-09, and draft 2020-12 through the Rust boon validator. It has no runtime dependency beyond PostgreSQL.
Latest-check note: upstream main currently points at the same commit as tag v0.1.9, so this refresh found no material user-facing delta beyond replacing the stale generated-SQL source link.
Validate a Schema and a Document
jsonschema_is_valid(schema) returns whether the schema itself compiles and validates against the selected draft. jsonschema_validates(data, schema) returns whether the JSON/JSONB value satisfies the schema.
Check Constraints
Use constraints when the database should reject malformed JSON documents at write time.
Composed Schemas
The id overloads let multiple schemas reference each other by $id, which is useful for componentized JSON Schema definitions.
Compatibility Functions
These wrappers mirror the common pg_jsonschema argument order: schema first, instance second.
Draft Selection and Caveats
If a schema omits $schema, jsonschema.default_draft controls the default draft. Supported values are V4, V6, V7, V2019, and V2020.
jsonschema_validates(data, schema)returns NULL if either argument is NULL.- Invalid or uncompilable schemas can raise errors in validation calls; failed document validation returns
falseand logs details atINFO. jsonschema_is_valid(id, VARIADIC schemas)andjsonschema_validates(data, id, VARIADIC schemas)require matching$idvalues for reliable composed-schema resolution.