mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 09:22:43 +03:00
218 lines
5.0 KiB
JSON
218 lines
5.0 KiB
JSON
{
|
|
"description": "error messages test",
|
|
"depends": [
|
|
"permission.json"
|
|
],
|
|
"items": [
|
|
{
|
|
"name": "create author 1 as admin",
|
|
"url": "/api/1/table/author/insert",
|
|
"role": "admin",
|
|
"user_id": "1",
|
|
"status_code": 200,
|
|
"request": {
|
|
"objects": [
|
|
{
|
|
"name": "Balaji",
|
|
"auth_id": 1,
|
|
"email": "google@balaji.com",
|
|
"id": 1
|
|
}
|
|
],
|
|
"returning": [
|
|
"id"
|
|
]
|
|
},
|
|
"method": "POST"
|
|
},
|
|
{
|
|
"name": "create author 1 as admin",
|
|
"url": "/api/1/table/author/insert",
|
|
"role": "admin",
|
|
"user_id": "1",
|
|
"status_code": 400,
|
|
"request": {
|
|
"objects": [
|
|
{
|
|
"name": "Balaji",
|
|
"auth_id": 1,
|
|
"email": "google@balaji.com",
|
|
"id": 1
|
|
}
|
|
],
|
|
"returning": [
|
|
"id"
|
|
]
|
|
},
|
|
"response": {
|
|
"path": "$",
|
|
"error": "Uniqueness violation. duplicate key value violates unique constraint \"author_pkey\""
|
|
},
|
|
"method": "POST"
|
|
},
|
|
{
|
|
"name": "create article with missing author_id",
|
|
"url": "/api/1/table/article/insert",
|
|
"role": "admin",
|
|
"user_id": "1",
|
|
"status_code": 400,
|
|
"request": {
|
|
"objects": [
|
|
{
|
|
"title": "LISP",
|
|
"rating": 1,
|
|
"category_id": 2,
|
|
"content": "Nothing here",
|
|
"is_published": false
|
|
}
|
|
],
|
|
"returning": [
|
|
"id"
|
|
]
|
|
},
|
|
"response": {
|
|
"path": "$",
|
|
"error": "Not-NULL violation. null value in column \"author_id\" violates not-null constraint"
|
|
},
|
|
"method": "POST"
|
|
},
|
|
{
|
|
"name": "create article with invalid author_id",
|
|
"url": "/api/1/table/article/insert",
|
|
"role": "admin",
|
|
"user_id": "1",
|
|
"status_code": 400,
|
|
"request": {
|
|
"objects": [
|
|
{
|
|
"title": "LISP",
|
|
"rating": 1,
|
|
"category_id": 2,
|
|
"content": "Nothing here",
|
|
"is_published": false,
|
|
"author_id": 2
|
|
}
|
|
],
|
|
"returning": [
|
|
"id"
|
|
]
|
|
},
|
|
"response": {
|
|
"path": "$",
|
|
"error": "Foreign key violation. insert or update on table \"article\" violates foreign key constraint \"article_author_id_fkey\""
|
|
},
|
|
"method": "POST"
|
|
},
|
|
{
|
|
"name": "create category",
|
|
"url": "/api/1/table/category/insert",
|
|
"role": "admin",
|
|
"user_id": "1",
|
|
"status_code": 200,
|
|
"request": {
|
|
"objects": [
|
|
{
|
|
"name": "Timepass",
|
|
"description": "Timepass stuff",
|
|
"id": 1
|
|
}
|
|
],
|
|
"returning": [
|
|
"id"
|
|
]
|
|
},
|
|
"method": "POST"
|
|
},
|
|
{
|
|
"name": "create valid article",
|
|
"url": "/api/1/table/article/insert",
|
|
"role": "admin",
|
|
"user_id": "1",
|
|
"status_code": 200,
|
|
"request": {
|
|
"objects": [
|
|
{
|
|
"title": "LISP",
|
|
"rating": 1,
|
|
"category_id": 1,
|
|
"content": "Nothing here",
|
|
"is_published": false,
|
|
"author_id": 1,
|
|
"id": 1
|
|
}
|
|
],
|
|
"returning": [
|
|
"id"
|
|
]
|
|
},
|
|
"method": "POST"
|
|
},
|
|
{
|
|
"name": "delete the author",
|
|
"url": "/api/1/query",
|
|
"role": "admin",
|
|
"user_id": "1",
|
|
"response": {
|
|
"path": "$",
|
|
"error": "Foreign key violation. update or delete on table \"author\" violates foreign key constraint \"article_author_id_fkey\" on table \"article\""
|
|
},
|
|
"status_code": 400,
|
|
"request": {
|
|
"kind": "delete",
|
|
"body": {
|
|
"table": "author",
|
|
"where": {
|
|
"id": 1
|
|
}
|
|
}
|
|
},
|
|
"method": "POST"
|
|
},
|
|
{
|
|
"name": "update the author",
|
|
"url": "/api/1/table/author/update",
|
|
"role": "admin",
|
|
"user_id": "1",
|
|
"status_code": 400,
|
|
"request": {
|
|
"where": {
|
|
"id": 1
|
|
},
|
|
"$set": {
|
|
"id": 20
|
|
},
|
|
"returning": [
|
|
"id"
|
|
]
|
|
},
|
|
"response": {
|
|
"path": "$",
|
|
"error": "Foreign key violation. update or delete on table \"author\" violates foreign key constraint \"article_author_id_fkey\" on table \"article\""
|
|
},
|
|
"method": "POST"
|
|
},
|
|
{
|
|
"name": "update the article",
|
|
"url": "/api/1/table/article/update",
|
|
"role": "admin",
|
|
"user_id": "1",
|
|
"status_code": 400,
|
|
"request": {
|
|
"where": {
|
|
"id": 1
|
|
},
|
|
"$set": {
|
|
"author_id": 2
|
|
},
|
|
"returning": [
|
|
"id"
|
|
]
|
|
},
|
|
"response": {
|
|
"path": "$",
|
|
"error": "Foreign key violation. insert or update on table \"article\" violates foreign key constraint \"article_author_id_fkey\""
|
|
},
|
|
"method": "POST"
|
|
}
|
|
]
|
|
} |