graphql-engine/server/tests-py/queries/graphql_query/custom_schema/author.yaml
Rakesh Emmadi 9bd5826020 allow customising graphql schema for a table (close #981) (#2509)
* allow customizing GraphQL root field names, close #981

* document v2 track_table API in reference

* support customising column field names in GraphQL schema

* [docs] add custom column fields doc in API reference

* add tests

* rename 'ColField' to 'ColumnField'

* embed column's graphql field in 'PGColumnInfo'

-> Value constructor of 'PGCol' is not exposed
-> Using 'parseJSON' to construct 'PGCol' in 'FromJSON' instances

* avoid using 'Maybe TableConfig'

* refactors & 'custom_column_fields' -> 'custom_column_names'

* cli-test: add configuration field in metadata export test

* update expected keys in `FromJSON` instance of `TableMeta`

* use `buildSchemaCacheFor` to update configuration in v2 track_table

* remove 'GraphQLName' type and use 'isValidName' exposed from parser lib

* point graphql-parser-hs library git repo to hasura

* support 'set_table_custom_fields' query API & added docs and tests
2019-09-19 10:17:36 +05:30

73 lines
1.3 KiB
YAML

description: Query author table with customised root field names
url: /v1/graphql
status: 200
response:
data:
Author:
AuthorId: 1
name: Author 1
Authors:
- AuthorId: 1
name: Author 1
articles:
- ArticleId: 1
title: Article 1
content: Content for Article 1
AuthorId: 1
- ArticleId: 2
title: Article 2
content: Content for Article 2
AuthorId: 1
- AuthorId: 2
name: Author 2
articles:
- ArticleId: 3
title: Article 3
content: Content for Article 3
AuthorId: 2
AuthorsWhere:
- AuthorId: 2
name: Author 2
AuthorAgg:
aggregate:
count: 2
nodes:
- AuthorId: 1
name: Author 1
- AuthorId: 2
name: Author 2
query:
query: |
query {
Author(AuthorId: 1){
AuthorId
name
}
Authors{
AuthorId
name
articles{
ArticleId
title
content
AuthorId
}
}
AuthorsWhere: Authors(where: {AuthorId: {_eq: 2}}){
AuthorId
name
}
AuthorAgg{
aggregate{
count
}
nodes{
AuthorId
name
}
}
}