mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-18 13:02:11 +03:00
29f2ddc289
This is an incremental PR towards https://github.com/hasura/graphql-engine/pull/5797 Co-authored-by: Anon Ray <ecthiender@users.noreply.github.com> GitOrigin-RevId: a6cb8c239b2ff840a0095e78845f682af0e588a9
170 lines
4.0 KiB
YAML
170 lines
4.0 KiB
YAML
- description: Add a computed field get_articles to author table
|
|
url: /v1/query
|
|
status: 200
|
|
query:
|
|
type: add_computed_field
|
|
args:
|
|
table: author
|
|
name: get_articles
|
|
definition:
|
|
function: fetch_articles
|
|
table_argument: author_row
|
|
response:
|
|
message: success
|
|
|
|
- description: Add a computed field full_name to author table
|
|
url: /v1/query
|
|
status: 200
|
|
query:
|
|
type: add_computed_field
|
|
args:
|
|
table: author
|
|
name: full_name
|
|
definition:
|
|
function: full_name
|
|
response:
|
|
message: success
|
|
|
|
- description: Create select permission with non existed computed fields
|
|
url: /v1/query
|
|
status: 400
|
|
query:
|
|
type: create_select_permission
|
|
args:
|
|
table: author
|
|
role: user
|
|
permission:
|
|
columns: '*'
|
|
computed_fields:
|
|
- full_name
|
|
- random
|
|
filter: {}
|
|
response:
|
|
internal:
|
|
- definition:
|
|
role: user
|
|
source: default
|
|
comment:
|
|
permission:
|
|
allow_aggregations: false
|
|
computed_fields:
|
|
- full_name
|
|
- random
|
|
columns: '*'
|
|
filter: {}
|
|
table:
|
|
schema: public
|
|
name: author
|
|
reason: 'in table "author": in permission for role "user": computed field "random"
|
|
does not exist'
|
|
type: select_permission
|
|
path: $.args
|
|
error: 'in table "author": in permission for role "user": computed field "random"
|
|
does not exist'
|
|
code: constraint-violation
|
|
- description: Create select permission with computed field which returns a set of
|
|
table
|
|
url: /v1/query
|
|
status: 400
|
|
query:
|
|
type: create_select_permission
|
|
args:
|
|
table: author
|
|
role: user
|
|
permission:
|
|
columns: '*'
|
|
computed_fields:
|
|
- full_name
|
|
- get_articles
|
|
filter: {}
|
|
response:
|
|
internal:
|
|
- definition:
|
|
role: user
|
|
source: default
|
|
comment:
|
|
permission:
|
|
allow_aggregations: false
|
|
computed_fields:
|
|
- full_name
|
|
- get_articles
|
|
columns: '*'
|
|
filter: {}
|
|
table:
|
|
schema: public
|
|
name: author
|
|
reason: 'in table "author": in permission for role "user": select permissions
|
|
on computed field "get_articles" are auto-derived from the permissions on
|
|
its returning table "article" and cannot be specified manually'
|
|
type: select_permission
|
|
path: $.args
|
|
error: 'in table "author": in permission for role "user": select permissions on
|
|
computed field "get_articles" are auto-derived from the permissions on its returning
|
|
table "article" and cannot be specified manually'
|
|
code: constraint-violation
|
|
- description: Create select permission on article table
|
|
url: /v1/query
|
|
status: 200
|
|
query:
|
|
type: create_select_permission
|
|
args:
|
|
table: article
|
|
role: user
|
|
permission:
|
|
columns: '*'
|
|
filter: {}
|
|
response:
|
|
message: success
|
|
|
|
- description: Create select permission with computed fields on author table
|
|
url: /v1/query
|
|
status: 200
|
|
query:
|
|
type: create_select_permission
|
|
args:
|
|
table: author
|
|
role: user
|
|
permission:
|
|
columns: '*'
|
|
computed_fields:
|
|
- full_name
|
|
filter: {}
|
|
response:
|
|
message: success
|
|
|
|
- description: Try to drop a computed field defined in permission
|
|
url: /v1/query
|
|
status: 400
|
|
query:
|
|
type: drop_computed_field
|
|
args:
|
|
table: author
|
|
name: full_name
|
|
response:
|
|
path: $.args
|
|
error: 'cannot drop due to the following dependent objects : permission author.user.select
|
|
in source "default"'
|
|
code: dependency-error
|
|
- description: Drop a computed field with cascade
|
|
url: /v1/query
|
|
status: 200
|
|
query:
|
|
type: drop_computed_field
|
|
args:
|
|
table: author
|
|
name: full_name
|
|
cascade: true
|
|
response:
|
|
message: success
|
|
|
|
- description: Drop a computed field
|
|
url: /v1/query
|
|
status: 200
|
|
query:
|
|
type: drop_computed_field
|
|
args:
|
|
table: author
|
|
name: get_articles
|
|
response:
|
|
message: success
|