mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-19 21:41:44 +03:00
134 lines
3.0 KiB
YAML
134 lines
3.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:
|
||
|
path: "$.args.computed_fields[1]"
|
||
|
error: computed field "random" does not exist
|
||
|
code: not-exists
|
||
|
|
||
|
- description: Create select permission with computed field whose return table's select permission is not defined
|
||
|
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:
|
||
|
path: "$.args.computed_fields[1]"
|
||
|
error: computed field "get_articles" executes function "fetch_articles" which returns
|
||
|
set of table "article"; select permission on "article" for role "user" does not
|
||
|
exist
|
||
|
code: permission-denied
|
||
|
|
||
|
- 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
|
||
|
- get_articles
|
||
|
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: get_articles
|
||
|
response:
|
||
|
path: "$.args"
|
||
|
error: 'cannot drop due to the following dependent objects : permission author.user.select'
|
||
|
code: dependency-error
|
||
|
|
||
|
- description: Drop a computed field with cascade
|
||
|
url: /v1/query
|
||
|
status: 200
|
||
|
query:
|
||
|
type: drop_computed_field
|
||
|
args:
|
||
|
table: author
|
||
|
name: get_articles
|
||
|
cascade: true
|
||
|
response:
|
||
|
message: success
|
||
|
|
||
|
- description: Drop a computed field
|
||
|
url: /v1/query
|
||
|
status: 200
|
||
|
query:
|
||
|
type: drop_computed_field
|
||
|
args:
|
||
|
table: author
|
||
|
name: full_name
|
||
|
response:
|
||
|
message: success
|