-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
143 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
-- Make sure the DSO is loaded. | ||
SELECT jsonschema_is_valid('{"type": "object"}'::json); | ||
jsonschema_is_valid | ||
--------------------- | ||
t | ||
(1 row) | ||
|
||
-- Should default to 2020 | ||
SELECT current_setting('jsonschema.default_draft'); | ||
current_setting | ||
----------------- | ||
V2020 | ||
(1 row) | ||
|
||
SHOW jsonschema.default_draft; | ||
jsonschema.default_draft | ||
-------------------------- | ||
V2020 | ||
(1 row) | ||
|
||
-- Set to 2019 | ||
SELECT set_config('jsonschema.default_draft', 'V2019', false); | ||
set_config | ||
------------ | ||
V2019 | ||
(1 row) | ||
|
||
SELECT current_setting('jsonschema.default_draft'); | ||
current_setting | ||
----------------- | ||
V2019 | ||
(1 row) | ||
|
||
SHOW jsonschema.default_draft; | ||
jsonschema.default_draft | ||
-------------------------- | ||
V2019 | ||
(1 row) | ||
|
||
-- Set to v7 | ||
SELECT set_config('jsonschema.default_draft', 'V7', false); | ||
set_config | ||
------------ | ||
V7 | ||
(1 row) | ||
|
||
SELECT current_setting('jsonschema.default_draft'); | ||
current_setting | ||
----------------- | ||
V7 | ||
(1 row) | ||
|
||
SHOW jsonschema.default_draft; | ||
jsonschema.default_draft | ||
-------------------------- | ||
V7 | ||
(1 row) | ||
|
||
-- Set to v6 | ||
SELECT set_config('jsonschema.default_draft', 'V6', false); | ||
set_config | ||
------------ | ||
V6 | ||
(1 row) | ||
|
||
SELECT current_setting('jsonschema.default_draft'); | ||
current_setting | ||
----------------- | ||
V6 | ||
(1 row) | ||
|
||
SHOW jsonschema.default_draft; | ||
jsonschema.default_draft | ||
-------------------------- | ||
V6 | ||
(1 row) | ||
|
||
-- Set to v4 | ||
SELECT set_config('jsonschema.default_draft', 'V4', false); | ||
set_config | ||
------------ | ||
V4 | ||
(1 row) | ||
|
||
SELECT current_setting('jsonschema.default_draft'); | ||
current_setting | ||
----------------- | ||
V4 | ||
(1 row) | ||
|
||
SHOW jsonschema.default_draft; | ||
jsonschema.default_draft | ||
-------------------------- | ||
V4 | ||
(1 row) | ||
|
||
-- Set to invalid value | ||
SELECT set_config('jsonschema.default_draft', 'Nope', false); | ||
ERROR: invalid value for parameter "jsonschema.default_draft": "Nope" | ||
HINT: Available values: V4, V6, V7, V2019, V2020. | ||
SELECT current_setting('jsonschema.default_draft'); | ||
current_setting | ||
----------------- | ||
V4 | ||
(1 row) | ||
|
||
SHOW jsonschema.default_draft; | ||
jsonschema.default_draft | ||
-------------------------- | ||
V4 | ||
(1 row) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
-- Make sure the DSO is loaded. | ||
SELECT jsonschema_is_valid('{"type": "object"}'::json); | ||
|
||
-- Should default to 2020 | ||
SELECT current_setting('jsonschema.default_draft'); | ||
SHOW jsonschema.default_draft; | ||
|
||
-- Set to 2019 | ||
SELECT set_config('jsonschema.default_draft', 'V2019', false); | ||
SELECT current_setting('jsonschema.default_draft'); | ||
SHOW jsonschema.default_draft; | ||
|
||
-- Set to v7 | ||
SELECT set_config('jsonschema.default_draft', 'V7', false); | ||
SELECT current_setting('jsonschema.default_draft'); | ||
SHOW jsonschema.default_draft; | ||
|
||
-- Set to v6 | ||
SELECT set_config('jsonschema.default_draft', 'V6', false); | ||
SELECT current_setting('jsonschema.default_draft'); | ||
SHOW jsonschema.default_draft; | ||
|
||
-- Set to v4 | ||
SELECT set_config('jsonschema.default_draft', 'V4', false); | ||
SELECT current_setting('jsonschema.default_draft'); | ||
SHOW jsonschema.default_draft; | ||
|
||
-- Set to invalid value | ||
SELECT set_config('jsonschema.default_draft', 'Nope', false); | ||
SELECT current_setting('jsonschema.default_draft'); | ||
SHOW jsonschema.default_draft; |