mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-09-11 10:46:25 +03:00
This commit is contained in:
parent
cfd7944849
commit
34288e1eb5
@ -13,6 +13,7 @@ If you do have such headers configured, then you must update the header configur
|
||||
|
||||
(Add entries here in the order of: server, console, cli, docs, others)
|
||||
|
||||
- server: fix failing introspection query when an enum column is part of a primary key (fixes #5200)
|
||||
- server: disallow headers from env variables starting with `HASURA_GRAPHQL_` in actions, event triggers & remote schemas (#5519)
|
||||
**WARNING**: This might break certain deployments. See `Breaking change` section above.
|
||||
- server: bugfix to allow HASURA_GRAPHQL_QUERY_PLAN_CACHE_SIZE of 0 (#5363)
|
||||
|
@ -214,6 +214,7 @@ mkMutationTypesAndFieldsRole tn insPermM selFldsM updColsM delPermM pkeyCols con
|
||||
(selFldsM ^.. _Just.traverse._SFPGColumn)
|
||||
<> (insPermM ^. _Just._1)
|
||||
<> (updColsM ^. _Just)
|
||||
<> (pkeyCols ^. _Just.pkColumns.to toList)
|
||||
allEnumReferences = allColumnInfos ^.. traverse.to pgiType._PGColumnEnumReference
|
||||
in flip map allEnumReferences $ \enumReference@(EnumReference referencedTableName _) ->
|
||||
let typeName = mkTableEnumType referencedTableName
|
||||
|
@ -0,0 +1,48 @@
|
||||
# https://github.com/hasura/graphql-engine/issues/5200
|
||||
description: Test introspecting enum types as user role
|
||||
url: /v1/graphql
|
||||
status: 200
|
||||
headers:
|
||||
X-Hasura-Role: user
|
||||
response:
|
||||
data:
|
||||
country:
|
||||
kind: ENUM
|
||||
name: country_enum
|
||||
enumValues:
|
||||
- name: India
|
||||
description: Republic of India
|
||||
- name: USA
|
||||
description: United States of America
|
||||
zones:
|
||||
fields:
|
||||
- name: code
|
||||
type:
|
||||
ofType:
|
||||
name: String
|
||||
- name: id
|
||||
type:
|
||||
ofType:
|
||||
name: Int
|
||||
query:
|
||||
query: |
|
||||
{
|
||||
country: __type(name: "country_enum") {
|
||||
name
|
||||
kind
|
||||
enumValues {
|
||||
name
|
||||
description
|
||||
}
|
||||
}
|
||||
zones: __type(name: "zones") {
|
||||
fields {
|
||||
name
|
||||
type {
|
||||
ofType {
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -23,12 +23,34 @@ args:
|
||||
('Alyssa', 'red'),
|
||||
('Ben', 'blue');
|
||||
|
||||
CREATE TABLE country
|
||||
( value text PRIMARY KEY
|
||||
, comment text);
|
||||
INSERT INTO country (value, comment) VALUES
|
||||
('India', 'Republic of India'),
|
||||
('USA', 'United States of America');
|
||||
|
||||
CREATE TABLE zones
|
||||
( id SERIAL
|
||||
, code text NOT NULL
|
||||
, country text NOT NULL REFERENCES country
|
||||
, PRIMARY KEY (code, country) );
|
||||
INSERT INTO zones (code, country) VALUES
|
||||
('67432', 'USA'),
|
||||
('600036', 'India');
|
||||
|
||||
- type: track_table
|
||||
args:
|
||||
table: colors
|
||||
is_enum: true
|
||||
- type: track_table
|
||||
args: users
|
||||
- type: track_table
|
||||
args:
|
||||
table: country
|
||||
is_enum: true
|
||||
- type: track_table
|
||||
args: zones
|
||||
|
||||
# Anonymous users can query users, but not colors
|
||||
- type: create_select_permission
|
||||
@ -38,3 +60,12 @@ args:
|
||||
permission:
|
||||
columns: [id, name, favorite_color]
|
||||
filter: {}
|
||||
|
||||
# A user can query only code but not country
|
||||
- type: create_select_permission
|
||||
args:
|
||||
table: zones
|
||||
role: user
|
||||
permission:
|
||||
columns: [id, code]
|
||||
filter: {}
|
||||
|
@ -5,4 +5,6 @@ args:
|
||||
sql: |
|
||||
DROP TABLE users;
|
||||
DROP TABLE colors;
|
||||
DROP TABLE zones;
|
||||
DROP TABLE country;
|
||||
cascade: true
|
||||
|
@ -561,6 +561,9 @@ class TestGraphQLQueryEnums:
|
||||
def test_introspect(self, hge_ctx, transport):
|
||||
check_query_f(hge_ctx, self.dir() + '/introspect.yaml', transport)
|
||||
|
||||
def test_introspect_user_role(self, hge_ctx, transport):
|
||||
check_query_f(hge_ctx, self.dir() + '/introspect_user_role.yaml', transport)
|
||||
|
||||
def test_select_enum_field(self, hge_ctx, transport):
|
||||
check_query_f(hge_ctx, self.dir() + '/select_enum_field.yaml', transport)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user