graphql-engine/server/testcases/json_jsonb.json
2018-06-28 00:32:00 +05:30

113 lines
2.8 KiB
JSON

{
"description": "json and jsonb column type test",
"depends": [],
"items": [
{
"name": "create_schema",
"url": "/api/1/query",
"role": "admin",
"status_code": 200,
"method": "POST",
"user_id": "1",
"sql_check": [
"select * from information_schema.columns where data_type = 'jsonb' and table_name = 'a' AND table_schema='public'",
"select * from information_schema.columns where data_type = 'json' and table_name = 'a' AND table_schema = 'public'"
],
"request": {
"kind": "create_table",
"body":
{
"primary_key": [
"id"
],
"name": "a",
"columns": [
{
"type": "serial",
"name": "id"
},
{
"type": "json",
"name": "a"
},
{
"type": "jsonb",
"name": "b"
}
]
}
}
},
{
"name": "set permission with filter on json column",
"url": "/api/1/query",
"role": "admin",
"status_code": 400,
"method": "POST",
"user_id": "1",
"response": {"path":"$.perm.filter","error":"JSON column can not be part of where clause"},
"request": {
"kind": "create_select_permission",
"body":
{
"role": "user",
"perm": {
"columns": ["id"],
"filter": {
"a": {"x" : 1}
}
},
"table": "a"
}
}
},
{
"name": "insert object",
"url": "/api/1/table/a/insert",
"role": "admin",
"status_code": 200,
"method": "POST",
"user_id": "1",
"request": {
"objects": [{
"a": {"a" : "b", "c": "d"},
"b": {"a" : "b", "c": "d"}
}],
"returning": [
"id", "a"
]
}
},
{
"name": "select with 'where' on JSONB column",
"url": "/api/1/table/a/select",
"role": "admin",
"status_code": 400,
"method": "POST",
"user_id": "1",
"response": {"path":"$.where","error":"JSONB column can not be part of where clause"},
"request": {
"columns": ["id"],
"where" : {
"b": { "$eq": {"a": "b", "c" : "d"}}
}
}
},
{
"name": "select with 'where' on JSON column",
"url": "/api/1/table/a/select",
"role": "admin",
"status_code": 400,
"method": "POST",
"user_id": "1",
"response": {"path":"$.where","error":"JSON column can not be part of where clause"},
"request": {
"columns": ["id"],
"where" : {
"a": { "$eq": {"a": "b", "c" : "d"}}
}
}
}
]
}