You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SELECT INTO v_result *, ARRAY[('{foo}','string is not a valid type: {array}')]::json_schema_validation_result[] = a AS valid FROM get_json_schema_validations(v_schema1, $$ { "foo": "string" } $$) a;
262
+
ASSERT v_result.valid, v_result;
263
+
SELECT INTO v_result *, ARRAY[('{foo}','items count of 3 exceeds maxItems of 2')]::json_schema_validation_result[] = a AS valid FROM get_json_schema_validations(v_schema1, $$ { "foo": ["string", "23", 1] } $$) a;
264
+
ASSERT v_result.valid, v_result;
265
+
SELECT INTO v_result *, ARRAY[]::json_schema_validation_result[] = a AS valid FROM get_json_schema_validations(v_schema1, $$ { "foo": ["string", 1] } $$) a;
266
+
ASSERT v_result.valid, v_result;
267
+
SELECT INTO v_result *, ARRAY[('{1}','string is not a valid type: {integer}')]::json_schema_validation_result[] = a AS valid FROM get_json_schema_validations('{"items": [{"type": "integer"}, {"$ref": "#/items/0"}]}', '[1, "foo"]') a;
268
+
ASSERT v_result.valid, v_result;
269
+
SELECT INTO v_result *, ARRAY[('{foo,0}','string is not a valid type: {number}')]::json_schema_validation_result[] = a AS valid FROM get_json_schema_validations(v_schema2, $$ { "foo": ["hello"] } $$) a;
270
+
ASSERT v_result.valid, v_result;
271
+
-- test string is not valid even if it is all digits when string_as_number is false
272
+
SELECT INTO v_result *, ARRAY[('{foo,0}','string is not a valid type: {number}')]::json_schema_validation_result[] = a AS valid FROM get_json_schema_validations(v_schema2, $$ { "foo": ["0"] } $$) a;
273
+
ASSERT v_result.valid, v_result;
274
+
-- test quoted number is valid when string_as_number is true with a literal string
275
+
SELECT INTO v_result *, ARRAY[]::json_schema_validation_result[] = a AS valid FROM get_json_schema_validations('{"type": "number"}', $$"1"$$, true) a;
276
+
ASSERT v_result.valid, v_result;
277
+
-- test quoted number is valid when string_as_number is true with a literal decimal string
278
+
SELECT INTO v_result *, ARRAY[]::json_schema_validation_result[] = a AS valid FROM get_json_schema_validations('{"type": "number"}', $$"1.1"$$, true) a;
279
+
ASSERT v_result.valid, v_result;
280
+
-- test quoted number is valid when string_as_number is true with an object
281
+
SELECT INTO v_result *, ARRAY[]::json_schema_validation_result[] = a AS valid FROM get_json_schema_validations('{"properties": {"foo": {"type": "number"}}}', $${ "foo": "1" }$$, true) a;
282
+
ASSERT v_result.valid, v_result;
283
+
-- test quoted number is valid when string_as_number is true with an array
284
+
SELECT INTO v_result *, ARRAY[]::json_schema_validation_result[] = a AS valid FROM get_json_schema_validations(v_schema2, $$ { "foo": ["0"] } $$, true) a;
285
+
ASSERT v_result.valid, v_result;
286
+
287
+
-- test quoted number when string_as_number is true with a invalid numerical string
288
+
SELECT INTO v_result *, ARRAY[('{}', 'string is not a valid type: {number}')]::json_schema_validation_result[] = a AS valid FROM get_json_schema_validations('{"type": "number"}', $$".1"$$, true) a;
289
+
ASSERT v_result.valid, v_result;
290
+
291
+
-- test quoted number when string_as_number is true with a invalid numerical string
292
+
SELECT INTO v_result *, ARRAY[('{}', 'string is not a valid type: {number}')]::json_schema_validation_result[] = a AS valid FROM get_json_schema_validations('{"type": "number"}', $$"0.1.1"$$, true) a;
293
+
ASSERT v_result.valid, v_result;
294
+
295
+
-- test quoted integer is not valid even when string_as_number is true
296
+
SELECT INTO v_result *, ARRAY[('{1}','string is not a valid type: {integer}')]::json_schema_validation_result[] = a AS valid FROM get_json_schema_validations('{"items": [{"type": "integer"}, {"$ref": "#/items/0"}]}', '[1, "1"]', true) a;
0 commit comments