mirror of
https://github.com/zhigang1992/graphql-engine.git
synced 2026-05-25 18:32:23 +08:00
Remove obsolete/unmaintained server Haskell test suite (#2472)
* Remove obsolete/unmaintained server Haskell test suite * Prune some unused server dependencies
This commit is contained in:
committed by
Vamshi Surabhi
parent
184683c87f
commit
6393aba447
@@ -53,11 +53,9 @@ library
|
||||
, Spock-core
|
||||
, split
|
||||
, optparse-applicative
|
||||
, wai-extra
|
||||
, containers
|
||||
, monad-control
|
||||
, monad-time
|
||||
, wai-logger
|
||||
, fast-logger
|
||||
, wai
|
||||
, postgresql-binary
|
||||
@@ -98,9 +96,6 @@ library
|
||||
-- Http client
|
||||
, wreq
|
||||
, http-client
|
||||
, http-client-tls
|
||||
, connection
|
||||
, retry
|
||||
|
||||
-- ordered map
|
||||
, insert-ordered-containers
|
||||
@@ -122,7 +117,6 @@ library
|
||||
-- websockets interface related
|
||||
, websockets
|
||||
, wai-websockets
|
||||
, hashtables
|
||||
, stm
|
||||
, stm-containers
|
||||
, list-t
|
||||
@@ -351,7 +345,6 @@ executable graphql-engine
|
||||
, http-client-tls
|
||||
, stm
|
||||
, wreq
|
||||
, connection
|
||||
, string-conversions
|
||||
, uuid
|
||||
|
||||
@@ -368,31 +361,3 @@ executable graphql-engine
|
||||
-Wincomplete-uni-patterns
|
||||
-Wredundant-constraints
|
||||
-threaded -rtsopts
|
||||
|
||||
test-suite graphql-engine-test
|
||||
type: exitcode-stdio-1.0
|
||||
main-is: Main.hs
|
||||
Default-Language: Haskell2010
|
||||
Hs-Source-Dirs: test
|
||||
ghc-options: -O2 -Wall
|
||||
Build-Depends: Spock-core >= 0.11
|
||||
, base
|
||||
, aeson
|
||||
, aeson-casing
|
||||
, bytestring
|
||||
, hspec
|
||||
, hspec-core
|
||||
, hspec-wai
|
||||
, optparse-applicative
|
||||
, graphql-engine -any
|
||||
, text
|
||||
, wai
|
||||
, pg-client
|
||||
, time
|
||||
, yaml
|
||||
, http-client
|
||||
, http-client-tls
|
||||
, unordered-containers >= 0.2
|
||||
, case-insensitive
|
||||
|
||||
other-modules: Spec
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE RankNTypes #-}
|
||||
|
||||
module Main where
|
||||
|
||||
import Data.Time.Clock (getCurrentTime)
|
||||
import Network.Wai (Application)
|
||||
import Options.Applicative
|
||||
import System.Environment (withArgs)
|
||||
import System.Exit (exitFailure)
|
||||
import Test.Hspec.Core.Runner
|
||||
import Test.Hspec.Wai
|
||||
|
||||
import qualified Data.Aeson as J
|
||||
import qualified Data.ByteString.Lazy.Char8 as BLC
|
||||
|
||||
import qualified Database.PG.Query as Q
|
||||
import qualified Hasura.Logging as L
|
||||
import Hasura.Prelude
|
||||
import Hasura.Server.App (mkWaiApp)
|
||||
import Hasura.Server.Auth (AuthMode (..))
|
||||
|
||||
|
||||
import qualified Database.PG.Query as PGQ
|
||||
import qualified Network.HTTP.Client as HTTP
|
||||
import qualified Network.HTTP.Client.TLS as HTTP
|
||||
|
||||
import Hasura.Server.Init
|
||||
import Ops (initCatalogSafe)
|
||||
import Spec (mkSpecs)
|
||||
|
||||
data ConnectionParams = ConnectionParams RawConnInfo Q.ConnParams
|
||||
|
||||
defTxMode :: Q.TxMode
|
||||
defTxMode = (Q.Serializable, Nothing)
|
||||
|
||||
resetStateTx :: Q.TxE PGQ.PGExecErr ()
|
||||
resetStateTx = do
|
||||
Q.unitQE PGQ.PGExecErrTx "DROP SCHEMA hdb_catalog CASCADE" () False
|
||||
Q.unitQE PGQ.PGExecErrTx "DROP SCHEMA hdb_views CASCADE" () False
|
||||
Q.unitQE PGQ.PGExecErrTx "DROP SCHEMA public CASCADE" () False
|
||||
Q.unitQE PGQ.PGExecErrTx "CREATE SCHEMA public" () False
|
||||
|
||||
ravenApp :: L.LoggerCtx -> PGQ.PGPool -> IO Application
|
||||
ravenApp loggerCtx pool = do
|
||||
let corsCfg = CorsConfigG "*" False -- cors is enabled
|
||||
httpManager <- HTTP.newManager HTTP.tlsManagerSettings
|
||||
-- spockAsApp $ spockT id $ app Q.Serializable Nothing rlogger pool AMNoAuth corsCfg True -- no admin secret and no webhook
|
||||
(app, _) <- mkWaiApp Q.Serializable Nothing loggerCtx pool httpManager AMNoAuth corsCfg True -- no admin secret and no webhook
|
||||
return app
|
||||
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
-- parse CLI flags for connection params
|
||||
ConnectionParams rci cp <- parseArgs
|
||||
-- form the postgres connection info
|
||||
ci <- either ((>> exitFailure) . (putStrLn . connInfoErrModifier))
|
||||
return $ mkConnInfo Nothing rci
|
||||
-- intialize the pool
|
||||
pool <- Q.initPGPool ci cp
|
||||
-- reset state in the database
|
||||
void $ liftIO $ runExceptT $ Q.runTx pool defTxMode resetStateTx
|
||||
-- intialize state for graphql-engine in the database
|
||||
liftIO $ initialise pool
|
||||
-- generate the test specs
|
||||
specs <- mkSpecs
|
||||
loggerCtx <- L.mkLoggerCtx $ L.defaultLoggerSettings True
|
||||
-- run the tests
|
||||
withArgs [] $ hspecWith defaultConfig $ with (ravenApp loggerCtx pool) specs
|
||||
|
||||
where
|
||||
initialise :: Q.PGPool -> IO ()
|
||||
initialise pool = do
|
||||
currentTime <- getCurrentTime
|
||||
res <- runExceptT $ Q.runTx pool defTxMode $ initCatalogSafe currentTime
|
||||
either ((>> exitFailure) . (BLC.putStrLn . J.encode)) putStrLn res
|
||||
|
||||
|
||||
parseArgs :: IO ConnectionParams
|
||||
parseArgs = execParser opts
|
||||
where
|
||||
optParser = ConnectionParams <$> parseRawConnInfo <*> parseConnParams
|
||||
|
||||
opts = info (helper <*> optParser)
|
||||
( fullDesc <>
|
||||
header "graphql-engine-test")
|
||||
@@ -1,165 +0,0 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
module Spec (mkSpecs) where
|
||||
|
||||
import Hasura.Prelude hiding (get)
|
||||
import Network.Wai (Application)
|
||||
import Test.Hspec
|
||||
import Test.Hspec.Wai
|
||||
import Test.Hspec.Wai.Matcher
|
||||
|
||||
import qualified Data.Aeson as J
|
||||
import qualified Data.Aeson.Casing as J
|
||||
import qualified Data.Aeson.TH as J
|
||||
import qualified Data.CaseInsensitive as CI
|
||||
import qualified Data.HashMap.Strict as HM
|
||||
import qualified Data.Text as T
|
||||
import qualified Data.Text.Encoding as T
|
||||
import qualified Data.Yaml as Y
|
||||
|
||||
type Headers = HM.HashMap T.Text T.Text
|
||||
|
||||
data TestCase
|
||||
= TestCase
|
||||
{ tcDescription :: !T.Text
|
||||
, tcQuery :: !J.Value
|
||||
, tcUrl :: !T.Text
|
||||
, tcHeaders :: !(Maybe Headers)
|
||||
, tcStatus :: !Int
|
||||
, tcResponse :: !(Maybe J.Value)
|
||||
-- , tcDependsOn :: !(Maybe TestCase)
|
||||
} deriving (Show)
|
||||
|
||||
$(J.deriveJSON (J.aesonDrop 2 J.snakeCase) ''TestCase)
|
||||
|
||||
|
||||
querySpecFiles :: [FilePath]
|
||||
querySpecFiles =
|
||||
[ "create_tables.yaml"
|
||||
, "track_tables.yaml"
|
||||
, "create_author_article_relationship.yaml"
|
||||
, "create_author_article_permissions.yaml"
|
||||
, "create_address_resident_relationship_error.yaml"
|
||||
, "create_user_permission_address.yaml"
|
||||
, "reload_metadata.yaml"
|
||||
, "create_author_permission_role_admin_error.yaml"
|
||||
, "create_user_permission_test_table.yaml"
|
||||
, "all_json_queries.yaml"
|
||||
, "upsert_role_user.yaml"
|
||||
, "upsert_role_user_error.yaml"
|
||||
]
|
||||
|
||||
gqlIntrospection :: FilePath
|
||||
gqlIntrospection = "introspection.yaml"
|
||||
|
||||
gqlSpecFiles :: [FilePath]
|
||||
gqlSpecFiles =
|
||||
[ "insert_mutation/author.yaml"
|
||||
, "introspection.yaml"
|
||||
, "introspection_user_role.yaml"
|
||||
, "insert_mutation/author.yaml"
|
||||
, "insert_mutation/author_articles_nested.yaml"
|
||||
, "insert_mutation/author_articles_nested_error.yaml"
|
||||
, "simple_select_query_author.yaml"
|
||||
, "select_query_author_by_pkey.yaml"
|
||||
, "insert_mutation/article.yaml"
|
||||
, "insert_mutation/article_author_nested.yaml"
|
||||
, "insert_mutation/article_author_nested_error.yaml"
|
||||
, "insert_mutation/article_on_conflict.yaml"
|
||||
, "insert_mutation/article_on_conflict_user_role.yaml"
|
||||
, "insert_mutation/article_on_conflict_update_columns.yaml"
|
||||
, "insert_mutation/article_on_conflict_ignore.yaml"
|
||||
, "insert_mutation/article_on_conflict_ignore_constraint.yaml"
|
||||
, "insert_mutation/article_on_conflict_empty_update_columns.yaml"
|
||||
, "insert_mutation/article_on_conflict_only_constraint.yaml"
|
||||
, "insert_mutation/article_on_conflict_error_01.yaml"
|
||||
, "insert_mutation/article_on_conflict_error_02.yaml"
|
||||
, "insert_mutation/article_on_conflict_error_03.yaml"
|
||||
, "insert_mutation/person.yaml"
|
||||
, "insert_mutation/person_array.yaml"
|
||||
, "insert_mutation/order.yaml"
|
||||
, "insert_mutation/address_check_constraint_error.yaml"
|
||||
, "insert_mutation/address_not_null_constraint_error.yaml"
|
||||
, "insert_mutation/author_unique_constraint_error.yaml"
|
||||
, "insert_mutation/author_on_conflict_ignore_user_role.yaml"
|
||||
, "insert_mutation/author_on_conflict_update_user_role.yaml"
|
||||
, "nested_select_query_article.yaml"
|
||||
, "select_query_article_limit_offset.yaml"
|
||||
, "select_query_article_limit_offset_error_01.yaml"
|
||||
, "select_query_article_limit_offset_error_02.yaml"
|
||||
, "update_mutation/author.yaml"
|
||||
, "update_mutation/person_set.yaml"
|
||||
, "update_mutation/person_append.yaml"
|
||||
, "update_mutation/person_prepend.yaml"
|
||||
, "update_mutation/person_delete_key.yaml"
|
||||
, "update_mutation/person_delete_elem.yaml"
|
||||
, "update_mutation/person_delete_at_path.yaml"
|
||||
, "update_mutation/person_inc.yaml"
|
||||
, "update_mutation/person_error_01.yaml"
|
||||
, "delete_mutation/article.yaml"
|
||||
, "delete_mutation/article_returning.yaml"
|
||||
, "delete_mutation/author_foreign_key_violation.yaml"
|
||||
]
|
||||
|
||||
alterTable :: FilePath
|
||||
alterTable = "alter_table.yaml"
|
||||
|
||||
readTestCase :: FilePath -> IO TestCase
|
||||
readTestCase fpath = do
|
||||
res <- Y.decodeFileEither ("test/testcases/" ++ fpath)
|
||||
case res of
|
||||
Left e -> do
|
||||
putStrLn $ Y.prettyPrintParseException e
|
||||
error $ "Could not parse testcase YAML: " ++ fpath
|
||||
Right q -> return q
|
||||
|
||||
mkSpec :: TestCase -> SpecWith Application
|
||||
mkSpec tc = do
|
||||
let desc = tcDescription tc
|
||||
url = tcUrl tc
|
||||
q = tcQuery tc
|
||||
mHeaders = tcHeaders tc
|
||||
statusCode = tcStatus tc
|
||||
mRespBody = tcResponse tc
|
||||
headers = maybe [] (map toHeader . HM.toList) mHeaders
|
||||
body = maybe matchAny bodyEquals $ fmap J.encode mRespBody
|
||||
resp = ResponseMatcher statusCode [] body
|
||||
it (T.unpack desc) $
|
||||
request "POST" (T.encodeUtf8 url) headers (J.encode q) `shouldRespondWith` resp
|
||||
where
|
||||
matchAny = MatchBody (\_ _ -> Nothing)
|
||||
toHeader (k, v) = (CI.mk $ T.encodeUtf8 k, T.encodeUtf8 v)
|
||||
|
||||
|
||||
mkSpecs :: IO (SpecWith Application)
|
||||
mkSpecs = do
|
||||
ddlTc <- mapM readTestCase querySpecFiles
|
||||
gqlTc <- mapM readTestCase gqlSpecFiles
|
||||
gqlIntrospectionTc <- readTestCase gqlIntrospection
|
||||
alterTabTc <- readTestCase alterTable
|
||||
return $ do
|
||||
describe "version API" $
|
||||
it "responds with version" $
|
||||
get "/v1/version" `shouldRespondWith` 200
|
||||
|
||||
describe "console endpoint" $
|
||||
it "responds with 200" $
|
||||
get "/console" `shouldRespondWith` 200
|
||||
|
||||
describe "CORS test" $
|
||||
it "should respond with correct CORS headers" $
|
||||
request "OPTIONS" "/v1/version" [("Origin", "example.com")] ""
|
||||
`shouldRespondWith` 204
|
||||
{matchHeaders = ["Access-Control-Allow-Origin" <:> "example.com"]}
|
||||
|
||||
describe "Query API" $ mapM_ mkSpec ddlTc
|
||||
|
||||
describe "GraphQL Introspection" $ mkSpec gqlIntrospectionTc
|
||||
|
||||
describe "GraphQL API" $ mapM_ mkSpec gqlTc
|
||||
|
||||
describe "Alter Table" $ mkSpec alterTabTc
|
||||
|
||||
describe "GraphQL Introspection after altering a table"
|
||||
$ mkSpec gqlIntrospectionTc
|
||||
@@ -1,56 +0,0 @@
|
||||
description: Select, Insert, Upsert, Update and Delete JSON queries
|
||||
url: /v1/query
|
||||
status: 200
|
||||
query:
|
||||
type: bulk
|
||||
args:
|
||||
- type: select
|
||||
args:
|
||||
table: author
|
||||
columns:
|
||||
- id
|
||||
- name
|
||||
- type: insert
|
||||
args:
|
||||
table: test_table
|
||||
objects:
|
||||
- name: erlich
|
||||
age: 30
|
||||
- name: gilfoyle
|
||||
age: 27
|
||||
returing:
|
||||
- id
|
||||
- name
|
||||
- age
|
||||
- type: update
|
||||
args:
|
||||
table: test_table
|
||||
where:
|
||||
id: 1
|
||||
$set:
|
||||
age: 31
|
||||
returing:
|
||||
- id
|
||||
- name
|
||||
- age
|
||||
- type: insert
|
||||
args:
|
||||
table: test_table
|
||||
objects:
|
||||
- id: 2
|
||||
name: galvin
|
||||
age: 45
|
||||
on_conflict:
|
||||
constraint_on:
|
||||
- id
|
||||
action: update
|
||||
returing:
|
||||
- id
|
||||
- name
|
||||
- age
|
||||
- type: delete
|
||||
args:
|
||||
table: test_table
|
||||
where:
|
||||
id: 2
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
description: Runs a bulk sql query to alter a table
|
||||
url: /v1/query
|
||||
status: 200
|
||||
query:
|
||||
type: bulk
|
||||
args:
|
||||
- type: run_sql
|
||||
args:
|
||||
sql: "ALTER TABLE dollar$test RENAME TO dollar_test"
|
||||
- type: run_sql
|
||||
args:
|
||||
sql: "ALTER TABLE dollar_test RENAME name TO name_altered"
|
||||
- type: run_sql
|
||||
args:
|
||||
sql: "ALTER TABLE dollar_test RENAME CONSTRAINT dollar$test_pkey TO dollar_test_pkey"
|
||||
@@ -1,10 +0,0 @@
|
||||
description: Create address to resident object relationship. But resident table is not tracked, so expecting a 400 error
|
||||
url: /v1/query
|
||||
status: 400
|
||||
query:
|
||||
type: create_object_relationship
|
||||
args:
|
||||
table: address
|
||||
name: resident
|
||||
using:
|
||||
foreign_key_constraint_on: resident_id
|
||||
@@ -1,54 +0,0 @@
|
||||
description: Create relevant permissions
|
||||
url: /v1/query
|
||||
status: 200
|
||||
query:
|
||||
type: bulk
|
||||
args:
|
||||
- type: create_select_permission
|
||||
args:
|
||||
table: article
|
||||
role: user
|
||||
permission:
|
||||
columns: '*'
|
||||
filter:
|
||||
$or:
|
||||
- author_id: X-HASURA-USER-ID
|
||||
- is_published: true
|
||||
- type: create_insert_permission
|
||||
args:
|
||||
table: article
|
||||
role: user
|
||||
permission:
|
||||
check:
|
||||
author_id: X-Hasura-User-Id
|
||||
- type: create_update_permission
|
||||
args:
|
||||
table: article
|
||||
role: user
|
||||
permission:
|
||||
columns: '*'
|
||||
filter:
|
||||
author_id: X-Hasura-User-Id
|
||||
- type: create_select_permission
|
||||
args:
|
||||
table: author
|
||||
role: user
|
||||
permission:
|
||||
columns: '*'
|
||||
filter:
|
||||
id: X-HASURA-USER-ID
|
||||
- type: create_insert_permission
|
||||
args:
|
||||
table: author
|
||||
role: user
|
||||
permission:
|
||||
check:
|
||||
id: X-HASURA-USER-ID
|
||||
- type: create_update_permission
|
||||
args:
|
||||
table: author
|
||||
role: user
|
||||
permission:
|
||||
columns: '*'
|
||||
filter:
|
||||
id: X-Hasura-User-Id
|
||||
@@ -1,20 +0,0 @@
|
||||
description: Creates relationships
|
||||
url: /v1/query
|
||||
status: 200
|
||||
query:
|
||||
type: bulk
|
||||
args:
|
||||
- type: create_object_relationship
|
||||
args:
|
||||
table: article
|
||||
name: author
|
||||
using:
|
||||
foreign_key_constraint_on: author_id
|
||||
- type: create_array_relationship
|
||||
args:
|
||||
table: author
|
||||
name: articles
|
||||
using:
|
||||
foreign_key_constraint_on:
|
||||
table: article
|
||||
column: author_id
|
||||
@@ -1,12 +0,0 @@
|
||||
description: Create permission with admin as role (error)
|
||||
url: /v1/query
|
||||
status: 400
|
||||
query:
|
||||
type: create_select_permission
|
||||
args:
|
||||
table: article
|
||||
role: admin
|
||||
permission:
|
||||
columns: '*'
|
||||
filter:
|
||||
id: X-Hasura-User-Id
|
||||
@@ -1,68 +0,0 @@
|
||||
description: Runs a bulk SQL query to create tables
|
||||
url: /v1/query
|
||||
status: 200
|
||||
query:
|
||||
type: bulk
|
||||
args:
|
||||
- type: run_sql
|
||||
args:
|
||||
sql: "CREATE TABLE author (id SERIAL PRIMARY KEY, name TEXT UNIQUE)"
|
||||
- type: run_sql
|
||||
args:
|
||||
sql: |
|
||||
CREATE TABLE article (
|
||||
id SERIAL PRIMARY KEY,
|
||||
title TEXT,
|
||||
content TEXT,
|
||||
author_id INTEGER REFERENCES author(id),
|
||||
is_published BOOLEAN,
|
||||
published_on TIMESTAMP
|
||||
)
|
||||
- type: run_sql
|
||||
args:
|
||||
sql: |
|
||||
CREATE TABLE person (
|
||||
id SERIAL PRIMARY KEY,
|
||||
details JSONB NOT NULL
|
||||
)
|
||||
- type: run_sql
|
||||
args:
|
||||
sql: |
|
||||
CREATE TABLE dollar$test (
|
||||
id SERIAL PRIMARY KEY,
|
||||
name TEXT NOT NULL
|
||||
)
|
||||
- type: run_sql
|
||||
args:
|
||||
sql: |
|
||||
CREATE TABLE resident (
|
||||
id SERIAL PRIMARY KEY,
|
||||
name TEXT NOT NULL,
|
||||
age INTEGER NOT NULL
|
||||
)
|
||||
- type: run_sql
|
||||
args:
|
||||
sql: |
|
||||
CREATE TABLE address (
|
||||
id SERIAL PRIMARY KEY,
|
||||
door_no TEXT NOT NULL,
|
||||
street TEXT NOT NULL,
|
||||
city TEXT NOT NULL,
|
||||
resident_id INTEGER REFERENCES resident(id)
|
||||
)
|
||||
- type: run_sql
|
||||
args:
|
||||
sql: |
|
||||
CREATE TABLE orders (
|
||||
id SERIAL PRIMARY KEY,
|
||||
placed TIMESTAMPTZ NOT NULL,
|
||||
shipped TIMESTAMPTZ
|
||||
)
|
||||
- type: run_sql
|
||||
args:
|
||||
sql: |
|
||||
CREATE TABLE test_table (
|
||||
id SERIAL PRIMARY KEY,
|
||||
name TEXT NOT NULL,
|
||||
age INTEGER NOT NULL
|
||||
)
|
||||
@@ -1,11 +0,0 @@
|
||||
description: Create a insert permission on address table for user role
|
||||
url: /v1/query
|
||||
status: 200
|
||||
query:
|
||||
type: create_insert_permission
|
||||
args:
|
||||
table: address
|
||||
role: merchant
|
||||
permission:
|
||||
check:
|
||||
city: bengaluru
|
||||
@@ -1,21 +0,0 @@
|
||||
description: Create a insert permission on test_table for user role
|
||||
url: /v1/query
|
||||
status: 200
|
||||
query:
|
||||
type: bulk
|
||||
args:
|
||||
- type: create_insert_permission
|
||||
args:
|
||||
table: test_table
|
||||
role: user
|
||||
permission:
|
||||
check:
|
||||
id: X-Hasura-User-Id
|
||||
- type: create_update_permission
|
||||
args:
|
||||
table: test_table
|
||||
role: user
|
||||
permission:
|
||||
filter:
|
||||
id: X-Hasura-User-Id
|
||||
columns: '*'
|
||||
@@ -1,12 +0,0 @@
|
||||
description: Delete mutation on article
|
||||
url: /v1alpha1/graphql
|
||||
status: 200
|
||||
query:
|
||||
query: |
|
||||
mutation delete_article {
|
||||
delete_article (
|
||||
where: {id: {_eq: 5}}
|
||||
) {
|
||||
affected_rows
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
description: Delete mutation on article with returning
|
||||
url: /v1alpha1/graphql
|
||||
status: 200
|
||||
query:
|
||||
query: |
|
||||
mutation delete_article {
|
||||
delete_article (
|
||||
where: {id: {_eq: 5}}
|
||||
) {
|
||||
affected_rows
|
||||
returning{
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
description: delete from author table (Foreign Key Violation Error)
|
||||
url: /v1alpha1/graphql
|
||||
status: 400
|
||||
query:
|
||||
query: |
|
||||
mutation {
|
||||
delete_author(where: {id: {_eq: 2}}){
|
||||
affected_rows
|
||||
}
|
||||
}
|
||||
response:
|
||||
errors:
|
||||
- path: $
|
||||
error: "Foreign key violation. update or delete on table \"author\" violates foreign key constraint \"article_author_id_fkey\" on table \"article\""
|
||||
code: constraint-violation
|
||||
@@ -1,17 +0,0 @@
|
||||
description: Insert into order table as user role (Check Constraint Error)
|
||||
url: /v1alpha1/graphql
|
||||
status: 400
|
||||
headers:
|
||||
X-Hasura-Role: merchant
|
||||
query:
|
||||
query: |
|
||||
mutation {
|
||||
insert_address(objects: [{door_no: "12-21", street: "Madhapur", city: "Hyderabad", resident_id: 1}]){
|
||||
affected_rows
|
||||
}
|
||||
}
|
||||
response:
|
||||
errors:
|
||||
- path: $.selectionSet.insert_address.args.objects
|
||||
error: Check constraint violation. insert check constraint failed
|
||||
code: permission-error
|
||||
@@ -1,19 +0,0 @@
|
||||
description: Insert into order table as user role (Not Null Constraint Error)
|
||||
url: /v1alpha1/graphql
|
||||
status: 400
|
||||
query:
|
||||
query: |
|
||||
mutation {
|
||||
insert_address(objects: [{street: "koramangala"}]){
|
||||
returning{
|
||||
id
|
||||
street
|
||||
}
|
||||
affected_rows
|
||||
}
|
||||
}
|
||||
response:
|
||||
errors:
|
||||
- path: $.selectionSet.insert_address.args.objects
|
||||
error: "Not-NULL violation. null value in column \"door_no\" violates not-null constraint"
|
||||
code: constraint-violation
|
||||
@@ -1,32 +0,0 @@
|
||||
description: Inserts article data via GraphQL mutation
|
||||
url: /v1alpha1/graphql
|
||||
status: 200
|
||||
query:
|
||||
query: |
|
||||
mutation insert_article {
|
||||
insert_article (
|
||||
objects: [
|
||||
{
|
||||
title: "Article 1",
|
||||
content: "Sample article content",
|
||||
author_id: 1
|
||||
},
|
||||
{
|
||||
title: "Article 2",
|
||||
content: "Sample article content",
|
||||
author_id: 1
|
||||
},
|
||||
{
|
||||
title: "Article 3",
|
||||
content: "Sample article content",
|
||||
author_id: 2
|
||||
}
|
||||
]
|
||||
) {
|
||||
returning {
|
||||
id
|
||||
title
|
||||
content
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
description: Insert article and it's author via nested mutation
|
||||
url: /v1alpha1/graphql
|
||||
status: 200
|
||||
query:
|
||||
query: |
|
||||
mutation article_author{
|
||||
insert_article(
|
||||
objects: [
|
||||
{
|
||||
title: "Article by author 4",
|
||||
content: "Article content for article by author 4",
|
||||
is_published: true
|
||||
author: {
|
||||
data: {
|
||||
name: "Article 4"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "Article by author 5",
|
||||
content: "Article content for article by author 5",
|
||||
is_published: true
|
||||
author: {
|
||||
data: {
|
||||
name: "Article 5"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
){
|
||||
affected_rows
|
||||
returning{
|
||||
id
|
||||
title
|
||||
content
|
||||
author{
|
||||
id
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
description: Insert article and it's author via nested mutation (Error)
|
||||
url: /v1alpha1/graphql
|
||||
status: 400
|
||||
query:
|
||||
query: |
|
||||
mutation article_author{
|
||||
insert_article(
|
||||
objects: [
|
||||
{
|
||||
title: "Article by author 4",
|
||||
content: "Article content for article by author 4",
|
||||
is_published: true,
|
||||
author_id: 4
|
||||
author: {
|
||||
data: {
|
||||
name: "Article 4"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "Article by author 5",
|
||||
content: "Article content for article by author 5",
|
||||
is_published: true,
|
||||
author_id: 5
|
||||
author: {
|
||||
data: {
|
||||
name: "Article 5"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
){
|
||||
affected_rows
|
||||
returning{
|
||||
id
|
||||
title
|
||||
content
|
||||
author{
|
||||
id
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
description: Upserts article data via GraphQL mutation
|
||||
url: /v1alpha1/graphql
|
||||
status: 200
|
||||
query:
|
||||
query: |
|
||||
mutation insert_article {
|
||||
insert_article (
|
||||
objects: [
|
||||
{
|
||||
content: "Updated Article 1 content",
|
||||
id: 1
|
||||
},
|
||||
{
|
||||
content: "Updated Article 2 content",
|
||||
id: 2
|
||||
}
|
||||
],
|
||||
on_conflict: {
|
||||
constraint: article_pkey,
|
||||
action: update
|
||||
}
|
||||
) {
|
||||
returning {
|
||||
title
|
||||
content
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
description: Upserts article data via GraphQL mutation with empty update columns
|
||||
url: /v1alpha1/graphql
|
||||
status: 200
|
||||
query:
|
||||
query: |
|
||||
mutation insert_article {
|
||||
insert_article (
|
||||
objects: [
|
||||
{
|
||||
content: "Updated Article 1 content",
|
||||
id: 1
|
||||
},
|
||||
{
|
||||
content: "Updated Article 2 content",
|
||||
id: 2
|
||||
}
|
||||
],
|
||||
on_conflict: {
|
||||
constraint: article_pkey,
|
||||
update_columns: []
|
||||
}
|
||||
) {
|
||||
returning {
|
||||
title
|
||||
content
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
description: Upserts article data via GraphQL mutation (Error 01)
|
||||
url: /v1alpha1/graphql
|
||||
status: 400
|
||||
query:
|
||||
query: |
|
||||
mutation insert_article {
|
||||
insert_article (
|
||||
objects: [
|
||||
{
|
||||
content: "Updated Article 1 content",
|
||||
id: 1
|
||||
},
|
||||
{
|
||||
content: "Updated Article 2 content",
|
||||
id: 2
|
||||
}
|
||||
],
|
||||
on_conflict: {
|
||||
action: update
|
||||
}
|
||||
) {
|
||||
returning {
|
||||
title
|
||||
content
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
description: Upserts article data via GraphQL mutation (Error 02)
|
||||
url: /v1alpha1/graphql
|
||||
status: 400
|
||||
query:
|
||||
query: |
|
||||
mutation insert_article {
|
||||
insert_article (
|
||||
objects: [
|
||||
{
|
||||
content: "Updated Article 1 content",
|
||||
id: 1
|
||||
},
|
||||
{
|
||||
content: "Updated Article 2 content",
|
||||
id: 2
|
||||
}
|
||||
],
|
||||
on_conflict: {
|
||||
action: random
|
||||
}
|
||||
) {
|
||||
returning {
|
||||
title
|
||||
content
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
description: Upserts article data via GraphQL mutation (Error 03)
|
||||
url: /v1alpha1/graphql
|
||||
status: 400
|
||||
query:
|
||||
query: |
|
||||
mutation insert_article {
|
||||
insert_article (
|
||||
objects: [
|
||||
{
|
||||
content: "Updated Article 1 content",
|
||||
id: 1
|
||||
},
|
||||
{
|
||||
content: "Updated Article 2 content",
|
||||
id: 2
|
||||
}
|
||||
],
|
||||
on_conflict: {
|
||||
action: update,
|
||||
constraint: random_constraint
|
||||
}
|
||||
) {
|
||||
returning {
|
||||
title
|
||||
content
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
description: Upserts article data via GraphQL mutation
|
||||
url: /v1alpha1/graphql
|
||||
status: 200
|
||||
query:
|
||||
query: |
|
||||
mutation insert_article {
|
||||
insert_article (
|
||||
objects: [
|
||||
{
|
||||
content: "Updated Article 1 content",
|
||||
id: 1
|
||||
},
|
||||
{
|
||||
content: "Updated Article 2 content",
|
||||
id: 2
|
||||
}
|
||||
],
|
||||
on_conflict: {
|
||||
constraint: article_pkey,
|
||||
action: ignore
|
||||
}
|
||||
) {
|
||||
returning {
|
||||
title
|
||||
content
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
description: Upserts article data via GraphQL mutation
|
||||
url: /v1alpha1/graphql
|
||||
status: 200
|
||||
query:
|
||||
query: |
|
||||
mutation insert_article {
|
||||
insert_article (
|
||||
objects: [
|
||||
{
|
||||
content: "Updated Article 1 content",
|
||||
id: 1
|
||||
},
|
||||
{
|
||||
content: "Updated Article 2 content",
|
||||
id: 2
|
||||
}
|
||||
],
|
||||
on_conflict: {
|
||||
constraint: article_pkey,
|
||||
action: ignore
|
||||
}
|
||||
) {
|
||||
returning {
|
||||
title
|
||||
content
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
description: Upserts article data via GraphQL mutation with only constraint
|
||||
url: /v1alpha1/graphql
|
||||
status: 200
|
||||
query:
|
||||
query: |
|
||||
mutation insert_article {
|
||||
insert_article (
|
||||
objects: [
|
||||
{
|
||||
content: "Updated Article 1 content",
|
||||
id: 1
|
||||
},
|
||||
{
|
||||
content: "Updated Article 2 content",
|
||||
id: 2
|
||||
}
|
||||
],
|
||||
on_conflict: {
|
||||
constraint: article_pkey
|
||||
}
|
||||
) {
|
||||
returning {
|
||||
title
|
||||
content
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
description: Upserts article data view GraphQL mutation using update columns
|
||||
url: /v1alpha1/graphql
|
||||
status: 200
|
||||
query:
|
||||
query: |
|
||||
mutation insert_article {
|
||||
insert_article (
|
||||
objects: [
|
||||
{
|
||||
title: "Update Article 2 title only",
|
||||
content: "Update Article 2 content",
|
||||
id: 2
|
||||
}
|
||||
],
|
||||
on_conflict: {
|
||||
constraint: article_pkey,
|
||||
update_columns: [title]
|
||||
}
|
||||
) {
|
||||
returning {
|
||||
title
|
||||
content
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
description: Upserts article data via GraphQL mutation as User role
|
||||
url: /v1alpha1/graphql
|
||||
status: 200
|
||||
headers:
|
||||
X-Hasura-Role: user
|
||||
X-Hasura-User-Id: '1'
|
||||
query:
|
||||
query: |
|
||||
mutation insert_article {
|
||||
insert_article (
|
||||
objects: [
|
||||
{
|
||||
content: "Updated Article 1 content",
|
||||
id: 1
|
||||
author_id: 1
|
||||
}
|
||||
],
|
||||
on_conflict: {
|
||||
constraint: article_pkey
|
||||
}
|
||||
) {
|
||||
returning {
|
||||
title
|
||||
content
|
||||
author_id
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
description: Inserts author data via GraphQL mutation
|
||||
url: /v1alpha1/graphql
|
||||
status: 200
|
||||
query:
|
||||
query: |
|
||||
mutation insert_author {
|
||||
insert_author(
|
||||
objects: [
|
||||
{
|
||||
name: "Author 1"
|
||||
},
|
||||
{
|
||||
name: "Author 2"
|
||||
}
|
||||
]
|
||||
) {
|
||||
returning {
|
||||
id
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
description: Insert author and it's articles via nested mutation
|
||||
url: /v1alpha1/graphql
|
||||
status: 200
|
||||
query:
|
||||
query: |
|
||||
mutation nested_author_insert {
|
||||
insert_author(
|
||||
objects: [
|
||||
{
|
||||
name: "Author 3",
|
||||
articles: {
|
||||
data: [
|
||||
{
|
||||
title: "An article by author 3",
|
||||
content: "Content for article by author 4",
|
||||
is_published: false
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
) {
|
||||
affected_rows
|
||||
returning {
|
||||
id
|
||||
name
|
||||
articles {
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
description: Insert author and it's articles via nested mutation (Error)
|
||||
url: /v1alpha1/graphql
|
||||
status: 400
|
||||
query:
|
||||
query: |
|
||||
mutation nested_author_insert {
|
||||
insert_author(
|
||||
objects: [
|
||||
{
|
||||
name: "Author 3",
|
||||
articles: {
|
||||
data: [
|
||||
{
|
||||
title: "An article by author 3",
|
||||
content: "Content for article by author 4",
|
||||
is_published: false,
|
||||
author_id: 3
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
) {
|
||||
affected_rows
|
||||
returning {
|
||||
id
|
||||
name
|
||||
articles {
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
description: Upserts author with id 1 as a user (Error)
|
||||
url: /v1alpha1/graphql
|
||||
status: 200
|
||||
headers:
|
||||
X-Hasura-Role: user
|
||||
X-Hasura-User-Id: '1'
|
||||
query:
|
||||
query: |
|
||||
mutation insert_author {
|
||||
insert_author (
|
||||
objects: [
|
||||
{
|
||||
id: 1
|
||||
name: "Author 1 Updated"
|
||||
}
|
||||
],
|
||||
on_conflict: {
|
||||
constraint: author_pkey,
|
||||
action: ignore
|
||||
}
|
||||
) {
|
||||
affected_rows
|
||||
returning {
|
||||
id
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
description: Upserts author with id 1 as a user
|
||||
url: /v1alpha1/graphql
|
||||
status: 200
|
||||
headers:
|
||||
X-Hasura-Role: user
|
||||
X-Hasura-User-Id: '1'
|
||||
query:
|
||||
query: |
|
||||
mutation insert_author {
|
||||
insert_author (
|
||||
objects: [
|
||||
{
|
||||
id: 1
|
||||
name: "Author 1 Updated"
|
||||
}
|
||||
],
|
||||
on_conflict: {
|
||||
action: update,
|
||||
constraint: author_pkey
|
||||
}
|
||||
) {
|
||||
affected_rows
|
||||
returning {
|
||||
id
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
description: Insert into author table as user role (Unique Constraint Error)
|
||||
url: /v1alpha1/graphql
|
||||
status: 400
|
||||
query:
|
||||
query: |
|
||||
mutation {
|
||||
insert_author(objects: [{name: "Author 2"}]){
|
||||
returning{
|
||||
id
|
||||
name
|
||||
}
|
||||
affected_rows
|
||||
}
|
||||
}
|
||||
response:
|
||||
errors:
|
||||
- path: $.selectionSet.insert_author.args.objects
|
||||
error: "Uniqueness violation. duplicate key value violates unique constraint \"author_name_key\""
|
||||
code: constraint-violation
|
||||
@@ -1,20 +0,0 @@
|
||||
description: Insert into order table with a null value
|
||||
url: /v1alpha1/graphql
|
||||
status: 200
|
||||
query:
|
||||
query: |
|
||||
mutation insert_orders{
|
||||
insert_orders(
|
||||
objects: [
|
||||
{
|
||||
placed: "2017-08-19 14:22:11.802755+02",
|
||||
shipped: null
|
||||
}
|
||||
]
|
||||
) {
|
||||
returning {
|
||||
id
|
||||
}
|
||||
affected_rows
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
description: Inserts person data via GraphQL mutation
|
||||
url: /v1alpha1/graphql
|
||||
status: 200
|
||||
query:
|
||||
variables:
|
||||
value:
|
||||
name:
|
||||
first: john
|
||||
last: murphy
|
||||
query: |
|
||||
mutation insert_person($value: jsonb) {
|
||||
insert_person(
|
||||
objects: [
|
||||
{
|
||||
details: $value
|
||||
}
|
||||
]
|
||||
) {
|
||||
returning {
|
||||
id
|
||||
details
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
description: Inserts persons data via GraphQL mutation
|
||||
url: /v1alpha1/graphql
|
||||
status: 200
|
||||
query:
|
||||
variables:
|
||||
value:
|
||||
- name:
|
||||
first: thelonious
|
||||
last: jaha
|
||||
- name:
|
||||
first: clarke
|
||||
last: griffin
|
||||
query: |
|
||||
mutation insert_person($value: jsonb) {
|
||||
insert_person(
|
||||
objects: [
|
||||
{
|
||||
details: $value
|
||||
}
|
||||
]
|
||||
) {
|
||||
returning {
|
||||
id
|
||||
details
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
description: Inserts article data via GraphQL mutation
|
||||
url: /v1alpha1/graphql
|
||||
status: 200
|
||||
query:
|
||||
query: |
|
||||
mutation insert_article {
|
||||
insert_article (
|
||||
objects: [
|
||||
{
|
||||
title: "Article 1",
|
||||
content: "Sample article content",
|
||||
author_id: 1,
|
||||
is_published: true
|
||||
},
|
||||
{
|
||||
title: "Article 2",
|
||||
content: "Sample article content",
|
||||
author_id: 1,
|
||||
is_published: true
|
||||
},
|
||||
{
|
||||
title: "Article 3",
|
||||
content: "Sample article content",
|
||||
author_id: 2,
|
||||
is_published: true
|
||||
},
|
||||
{
|
||||
title: "Article 4",
|
||||
content: "Sample article content",
|
||||
author_id: 1,
|
||||
is_published: false
|
||||
},
|
||||
{
|
||||
title: "Article 5",
|
||||
content: "Sample article content",
|
||||
author_id: 2,
|
||||
is_published: false
|
||||
}
|
||||
]
|
||||
) {
|
||||
returning {
|
||||
id
|
||||
title
|
||||
content
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
description: GraphQL introspection query
|
||||
url: /v1alpha1/graphql
|
||||
status: 200
|
||||
query:
|
||||
query: |
|
||||
query IntrospectionQuery {
|
||||
__schema {
|
||||
queryType {
|
||||
name
|
||||
}
|
||||
mutationType {
|
||||
name
|
||||
}
|
||||
subscriptionType {
|
||||
name
|
||||
}
|
||||
types {
|
||||
...FullType
|
||||
}
|
||||
directives {
|
||||
name
|
||||
description
|
||||
locations
|
||||
args {
|
||||
...InputValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fragment FullType on __Type {
|
||||
kind
|
||||
name
|
||||
description
|
||||
fields(includeDeprecated: true) {
|
||||
name
|
||||
description
|
||||
args {
|
||||
...InputValue
|
||||
}
|
||||
type {
|
||||
...TypeRef
|
||||
}
|
||||
isDeprecated
|
||||
deprecationReason
|
||||
}
|
||||
inputFields {
|
||||
...InputValue
|
||||
}
|
||||
interfaces {
|
||||
...TypeRef
|
||||
}
|
||||
enumValues(includeDeprecated: true) {
|
||||
name
|
||||
description
|
||||
isDeprecated
|
||||
deprecationReason
|
||||
}
|
||||
possibleTypes {
|
||||
...TypeRef
|
||||
}
|
||||
}
|
||||
|
||||
fragment InputValue on __InputValue {
|
||||
name
|
||||
description
|
||||
type {
|
||||
...TypeRef
|
||||
}
|
||||
defaultValue
|
||||
}
|
||||
|
||||
fragment TypeRef on __Type {
|
||||
kind
|
||||
name
|
||||
ofType {
|
||||
kind
|
||||
name
|
||||
ofType {
|
||||
kind
|
||||
name
|
||||
ofType {
|
||||
kind
|
||||
name
|
||||
ofType {
|
||||
kind
|
||||
name
|
||||
ofType {
|
||||
kind
|
||||
name
|
||||
ofType {
|
||||
kind
|
||||
name
|
||||
ofType {
|
||||
kind
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,106 +0,0 @@
|
||||
description: GraphQL introspection query as user role
|
||||
url: /v1alpha1/graphql
|
||||
status: 200
|
||||
headers:
|
||||
X-Hasura-Role: user
|
||||
query:
|
||||
query: |
|
||||
query IntrospectionQuery {
|
||||
__schema {
|
||||
queryType {
|
||||
name
|
||||
}
|
||||
mutationType {
|
||||
name
|
||||
}
|
||||
subscriptionType {
|
||||
name
|
||||
}
|
||||
types {
|
||||
...FullType
|
||||
}
|
||||
directives {
|
||||
name
|
||||
description
|
||||
locations
|
||||
args {
|
||||
...InputValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fragment FullType on __Type {
|
||||
kind
|
||||
name
|
||||
description
|
||||
fields(includeDeprecated: true) {
|
||||
name
|
||||
description
|
||||
args {
|
||||
...InputValue
|
||||
}
|
||||
type {
|
||||
...TypeRef
|
||||
}
|
||||
isDeprecated
|
||||
deprecationReason
|
||||
}
|
||||
inputFields {
|
||||
...InputValue
|
||||
}
|
||||
interfaces {
|
||||
...TypeRef
|
||||
}
|
||||
enumValues(includeDeprecated: true) {
|
||||
name
|
||||
description
|
||||
isDeprecated
|
||||
deprecationReason
|
||||
}
|
||||
possibleTypes {
|
||||
...TypeRef
|
||||
}
|
||||
}
|
||||
|
||||
fragment InputValue on __InputValue {
|
||||
name
|
||||
description
|
||||
type {
|
||||
...TypeRef
|
||||
}
|
||||
defaultValue
|
||||
}
|
||||
|
||||
fragment TypeRef on __Type {
|
||||
kind
|
||||
name
|
||||
ofType {
|
||||
kind
|
||||
name
|
||||
ofType {
|
||||
kind
|
||||
name
|
||||
ofType {
|
||||
kind
|
||||
name
|
||||
ofType {
|
||||
kind
|
||||
name
|
||||
ofType {
|
||||
kind
|
||||
name
|
||||
ofType {
|
||||
kind
|
||||
name
|
||||
ofType {
|
||||
kind
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
description: Nested select on article
|
||||
url: /v1alpha1/graphql
|
||||
status: 200
|
||||
query:
|
||||
query: |
|
||||
query {
|
||||
article {
|
||||
id
|
||||
title
|
||||
content
|
||||
author {
|
||||
id
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
description: Select author and their articles
|
||||
url: /v1alpha1/graphql
|
||||
status: 200
|
||||
query:
|
||||
query: |
|
||||
query {
|
||||
author (where: {name: {_eq: "Author 1"}}) {
|
||||
id
|
||||
name
|
||||
articles (
|
||||
where: {is_published: {_eq: true}}
|
||||
limit: 10,
|
||||
offset: 1
|
||||
) {
|
||||
id
|
||||
title
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
description: Reload schema cache (metadata)
|
||||
url: /v1/query
|
||||
status: 200
|
||||
query:
|
||||
type: reload_metadata
|
||||
args: {}
|
||||
@@ -1,16 +0,0 @@
|
||||
description: Nested select on article with limit
|
||||
url: /v1alpha1/graphql
|
||||
status: 200
|
||||
query:
|
||||
query: |
|
||||
query {
|
||||
article(limit: 3, offset: 2) {
|
||||
id
|
||||
title
|
||||
content
|
||||
author {
|
||||
id
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
description: Nested select on article with limit expecting error
|
||||
url: /v1alpha1/graphql
|
||||
status: 400
|
||||
query:
|
||||
query: |
|
||||
query {
|
||||
article(limit: "3", offset: 1) {
|
||||
id
|
||||
title
|
||||
content
|
||||
author {
|
||||
id
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
description: Nested select on article with limit expecting error
|
||||
url: /v1alpha1/graphql
|
||||
status: 400
|
||||
query:
|
||||
query: |
|
||||
query {
|
||||
article(limit: -1, offset: 1) {
|
||||
id
|
||||
title
|
||||
content
|
||||
author {
|
||||
id
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
description: select query on author with id = 1
|
||||
url: /v1alpha1/graphql
|
||||
status: 200
|
||||
response:
|
||||
data:
|
||||
author_by_pk:
|
||||
name: Author 1
|
||||
id: 1
|
||||
query:
|
||||
query: |
|
||||
query {
|
||||
author_by_pk(id: 1){
|
||||
id
|
||||
name
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
description: Simple GraphQL object query on author
|
||||
url: /v1alpha1/graphql
|
||||
status: 200
|
||||
query:
|
||||
query: |
|
||||
query {
|
||||
author {
|
||||
id
|
||||
name
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
description: Track the above created tables
|
||||
url: /v1/query
|
||||
status: 200
|
||||
query:
|
||||
type: bulk
|
||||
args:
|
||||
- type: track_table
|
||||
args:
|
||||
schema: public
|
||||
name: author
|
||||
- type: track_table
|
||||
args:
|
||||
schema: public
|
||||
name: article
|
||||
- type: track_table
|
||||
args:
|
||||
schema: public
|
||||
name: person
|
||||
- type: track_table
|
||||
args:
|
||||
schema: public
|
||||
name: dollar$test
|
||||
- type: track_table
|
||||
args:
|
||||
schema: public
|
||||
name: address
|
||||
- type: track_table
|
||||
args:
|
||||
schema: public
|
||||
name: orders
|
||||
- type: track_table
|
||||
args:
|
||||
schema: public
|
||||
name: test_table
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
description: Update mutation on author
|
||||
url: /v1alpha1/graphql
|
||||
status: 200
|
||||
query:
|
||||
query: |
|
||||
mutation update_author {
|
||||
update_author(
|
||||
where: {id: {_eq: 1}},
|
||||
_set: {name: "Jane"}
|
||||
) {
|
||||
affected_rows
|
||||
returning{
|
||||
id
|
||||
name
|
||||
articles{
|
||||
id
|
||||
title
|
||||
content
|
||||
is_published
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
description: Updated person data using _append operator
|
||||
url: /v1alpha1/graphql
|
||||
status: 200
|
||||
query:
|
||||
variables:
|
||||
value:
|
||||
address:
|
||||
country: Australia
|
||||
city: Sydney
|
||||
query: |
|
||||
mutation update_person($value: jsonb) {
|
||||
update_person(
|
||||
where: {id: {_eq: 1}},
|
||||
_append: {
|
||||
details: $value
|
||||
}
|
||||
){
|
||||
affected_rows
|
||||
returning{
|
||||
id
|
||||
details
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
description: Updated person data using _delete_at_path operator
|
||||
url: /v1alpha1/graphql
|
||||
status: 200
|
||||
query:
|
||||
query: |
|
||||
mutation update_person($value: jsonb) {
|
||||
update_person(
|
||||
where: {id: {_eq: 1}},
|
||||
_delete_at_path: {
|
||||
details: ["name", "last"]
|
||||
}
|
||||
){
|
||||
affected_rows
|
||||
returning{
|
||||
id
|
||||
details
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
description: Updated person data using _delete_elem operator
|
||||
url: /v1alpha1/graphql
|
||||
status: 200
|
||||
query:
|
||||
query: |
|
||||
mutation update_person($value: jsonb) {
|
||||
update_person(
|
||||
where: {id: {_eq: 2}},
|
||||
_delete_elem: {
|
||||
details: 0
|
||||
}
|
||||
){
|
||||
affected_rows
|
||||
returning{
|
||||
id
|
||||
details
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
description: Updated person data using _delete_key operator
|
||||
url: /v1alpha1/graphql
|
||||
status: 200
|
||||
query:
|
||||
query: |
|
||||
mutation update_person($value: jsonb) {
|
||||
update_person(
|
||||
where: {id: {_eq: 1}},
|
||||
_delete_key: {
|
||||
details: "address"
|
||||
}
|
||||
){
|
||||
affected_rows
|
||||
returning{
|
||||
id
|
||||
details
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
description: Updated person data without any operator
|
||||
url: /v1alpha1/graphql
|
||||
status: 400
|
||||
query:
|
||||
query: |
|
||||
mutation update_person($value: jsonb) {
|
||||
update_person(
|
||||
where: {id: {_eq: 2}}
|
||||
){
|
||||
affected_rows
|
||||
returning{
|
||||
id
|
||||
details
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
description: Updated person data using _inc operator
|
||||
url: /v1alpha1/graphql
|
||||
status: 200
|
||||
query:
|
||||
query: |
|
||||
mutation update_person($value: jsonb) {
|
||||
update_person(
|
||||
where: {id: {_eq: 2}},
|
||||
_inc: {
|
||||
id: 1
|
||||
}
|
||||
){
|
||||
affected_rows
|
||||
returning{
|
||||
id
|
||||
details
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
description: Updated person data using _prepend operator
|
||||
url: /v1alpha1/graphql
|
||||
status: 200
|
||||
query:
|
||||
variables:
|
||||
value:
|
||||
university:
|
||||
name: Sydney university
|
||||
query: |
|
||||
mutation update_person($value: jsonb) {
|
||||
update_person(
|
||||
where: {id: {_eq: 1}},
|
||||
_prepend: {
|
||||
details: $value
|
||||
}
|
||||
){
|
||||
affected_rows
|
||||
returning{
|
||||
id
|
||||
details
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
description: Updated person data using _set operator
|
||||
url: /v1alpha1/graphql
|
||||
status: 200
|
||||
query:
|
||||
variables:
|
||||
value:
|
||||
name:
|
||||
first: john
|
||||
last: taylor
|
||||
query: |
|
||||
mutation update_person($value: jsonb) {
|
||||
update_person(
|
||||
where: {id: {_eq: 1}},
|
||||
_set: {
|
||||
details: $value
|
||||
}
|
||||
){
|
||||
affected_rows
|
||||
returning{
|
||||
id
|
||||
details
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
description: upsert into test_table with user role
|
||||
url: v1/query
|
||||
headers:
|
||||
X-Hasura-Role: user
|
||||
X-Hasura-User-Id: '1'
|
||||
status: 200
|
||||
query:
|
||||
type: insert
|
||||
args:
|
||||
table: test_table
|
||||
objects:
|
||||
- id: 1
|
||||
name: monika
|
||||
age: 25
|
||||
on_conflict:
|
||||
constraint: test_table_pkey
|
||||
action: update
|
||||
@@ -1,19 +0,0 @@
|
||||
description: Upsert on test_table as user role with constraint on columns (error)
|
||||
url: /v1/query
|
||||
headers:
|
||||
X-Hasura-Role: user
|
||||
X-Hasura-User-Id: '1'
|
||||
status: 400
|
||||
query:
|
||||
type: insert
|
||||
args:
|
||||
table: test_table
|
||||
objects:
|
||||
- id: 1
|
||||
name: monika
|
||||
age: 25
|
||||
on_conflict:
|
||||
constraint_on:
|
||||
- id
|
||||
action: ignore
|
||||
|
||||
Reference in New Issue
Block a user