- Notifications
You must be signed in to change notification settings - Fork34
JSON Schema validation for PostgreSQL
License
gavinwahl/postgres-json-schema
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
postgres-json-schema allows validation ofJSONschemas in PostgreSQL. It is implemented as aPL/pgSQL function and you can use it as a check constraint to validate theformat of your JSON columns.
postgres-json-schema supports the entire JSON schema draft v4 spec, except forremote (http) references. It's tested against the officialJSON-Schema-Test-Suite.
postgres-json-schema is packaged as an PGXS extension. To install, just runmake install as root, thenCREATE EXTENSION "postgres-json-schema"; as thedatabase superuser.
CREATE TABLE example (id serial PRIMARY KEY, data jsonb);ALTER TABLE example ADD CONSTRAINT data_is_valid CHECK (validate_json_schema('{"type": "object"}', data));INSERT INTO example (data) VALUES ('{}');-- INSERT 0 1INSERT INTO example (data) VALUES ('1');-- ERROR: new row for relation "example" violates check constraint "data_is_valid"-- DETAIL: Failing row contains (2, 1).About
JSON Schema validation for PostgreSQL
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors3
Uh oh!
There was an error while loading.Please reload this page.