mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-18 13:02:11 +03:00
214 lines
4.1 KiB
YAML
214 lines
4.1 KiB
YAML
|
# Test with graphql-default naming convention
|
||
|
|
||
|
# Please note that we don't need to set the naming convention in the source
|
||
|
# customisation as we are using the environment variable (already set)
|
||
|
# HASURA_GRAPHQL_DEFAULT_NAMING_CONVENTION
|
||
|
- description: PG add source
|
||
|
url: /v1/metadata
|
||
|
status: 200
|
||
|
response:
|
||
|
message: success
|
||
|
query:
|
||
|
type: pg_add_source
|
||
|
args:
|
||
|
name: pg1
|
||
|
configuration:
|
||
|
connection_info:
|
||
|
database_url:
|
||
|
from_env: HASURA_GRAPHQL_PG_SOURCE_URL_1
|
||
|
pool_settings:
|
||
|
max_connections: 50
|
||
|
idle_timeout: 180
|
||
|
retries:
|
||
|
|
||
|
- description: create table 1
|
||
|
url: /v1/query
|
||
|
status: 200
|
||
|
response:
|
||
|
result_type: CommandOk
|
||
|
result:
|
||
|
query:
|
||
|
type: run_sql
|
||
|
args:
|
||
|
source: pg1
|
||
|
sql: |
|
||
|
create table author_local(
|
||
|
id serial primary key,
|
||
|
name text unique
|
||
|
);
|
||
|
INSERT INTO author_local (name)
|
||
|
VALUES ('Author 1'), ('Author 2');
|
||
|
|
||
|
- description: track table
|
||
|
url: /v1/metadata
|
||
|
status: 200
|
||
|
response:
|
||
|
message: success
|
||
|
query:
|
||
|
type: pg_track_table
|
||
|
args:
|
||
|
table: author_local
|
||
|
source: pg1
|
||
|
|
||
|
- description: Simple GraphQL query to fetch items from the source table
|
||
|
url: /v1/graphql
|
||
|
status: 200
|
||
|
response:
|
||
|
data:
|
||
|
authorLocal:
|
||
|
- id: 1
|
||
|
name: 'Author 1'
|
||
|
__typename: AuthorLocal
|
||
|
- id: 2
|
||
|
name: 'Author 2'
|
||
|
__typename: AuthorLocal
|
||
|
query:
|
||
|
query: |
|
||
|
query {
|
||
|
authorLocal {
|
||
|
id
|
||
|
name
|
||
|
__typename
|
||
|
}
|
||
|
}
|
||
|
|
||
|
- description: Simple GraphQL query with field aliases to fetch items from the source table
|
||
|
url: /v1/graphql
|
||
|
status: 200
|
||
|
response:
|
||
|
data:
|
||
|
a:
|
||
|
- b: 1
|
||
|
c: 'Author 1'
|
||
|
d: AuthorLocal
|
||
|
- b: 2
|
||
|
c: 'Author 2'
|
||
|
d: AuthorLocal
|
||
|
query:
|
||
|
query: |
|
||
|
query {
|
||
|
a: authorLocal {
|
||
|
b: id
|
||
|
c: name
|
||
|
d: __typename
|
||
|
}
|
||
|
}
|
||
|
|
||
|
- description: Lookup by pk
|
||
|
url: /v1/graphql
|
||
|
status: 200
|
||
|
response:
|
||
|
data:
|
||
|
authorLocalByPk:
|
||
|
id: 1
|
||
|
name: 'Author 1'
|
||
|
__typename: AuthorLocal
|
||
|
query:
|
||
|
query: |
|
||
|
query {
|
||
|
authorLocalByPk(id: 1) {
|
||
|
id
|
||
|
name
|
||
|
__typename
|
||
|
}
|
||
|
}
|
||
|
|
||
|
- description: Aggregate
|
||
|
url: /v1/graphql
|
||
|
status: 200
|
||
|
response:
|
||
|
data:
|
||
|
authorLocalAggregate:
|
||
|
__typename: AuthorLocalAggregate
|
||
|
aggregate:
|
||
|
__typename: AuthorLocalAggregateFields
|
||
|
count: 1
|
||
|
query:
|
||
|
query: |
|
||
|
query MyQuery {
|
||
|
authorLocalAggregate(where: {name: {_eq: "Author 2"}}) {
|
||
|
__typename
|
||
|
aggregate {
|
||
|
__typename
|
||
|
count
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
- description: Insert
|
||
|
url: /v1/graphql
|
||
|
status: 200
|
||
|
response:
|
||
|
data:
|
||
|
insertAuthorLocal:
|
||
|
__typename: AuthorLocalMutationResponse
|
||
|
returning:
|
||
|
- __typename: AuthorLocal
|
||
|
id: 3
|
||
|
name: Author 3
|
||
|
query:
|
||
|
query: |
|
||
|
mutation MyMutation {
|
||
|
insertAuthorLocal(objects: {name: "Author 3", id: 3}) {
|
||
|
__typename
|
||
|
returning {
|
||
|
__typename
|
||
|
id
|
||
|
name
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
- description: Delete by pk
|
||
|
url: /v1/graphql
|
||
|
status: 200
|
||
|
response:
|
||
|
data:
|
||
|
deleteAuthorLocalByPk:
|
||
|
__typename: AuthorLocal
|
||
|
id: 3
|
||
|
name: Author 3
|
||
|
query:
|
||
|
query: |
|
||
|
mutation MyMutation {
|
||
|
deleteAuthorLocalByPk(id: 3) {
|
||
|
__typename
|
||
|
id
|
||
|
name
|
||
|
}
|
||
|
}
|
||
|
|
||
|
- description: untrack table
|
||
|
url: /v1/metadata
|
||
|
status: 200
|
||
|
response:
|
||
|
message: success
|
||
|
query:
|
||
|
type: pg_untrack_table
|
||
|
args:
|
||
|
table: author_local
|
||
|
source: pg1
|
||
|
|
||
|
- description: drop table
|
||
|
url: /v1/query
|
||
|
status: 200
|
||
|
response:
|
||
|
result_type: CommandOk
|
||
|
result:
|
||
|
query:
|
||
|
type: run_sql
|
||
|
args:
|
||
|
source: pg1
|
||
|
sql: |
|
||
|
drop table author_local;
|
||
|
|
||
|
- description: PG Drop Source 1
|
||
|
url: /v1/metadata
|
||
|
status: 200
|
||
|
response:
|
||
|
message: success
|
||
|
query:
|
||
|
type: pg_drop_source
|
||
|
args:
|
||
|
name: pg1
|