graphql-engine/server/tests-py/queries/graphql_introspection/disable_introspection/disable_introspection.yaml
Karthikeyan Chinnakonda 4702ba514a pro server: disable GraphQL schema introspection for specified roles
GitOrigin-RevId: 36ceb1852bc7779092cfb59c92035dd9635b2e3f
2021-05-05 12:26:23 +00:00

65 lines
1.4 KiB
YAML

- description: throw error when executing query with the '__schema' field for a introspection disabled role
url: /v1/graphql
status: 200
headers:
X-Hasura-Role: introspection_disabled
response:
errors:
- extensions:
path: $
code: not-supported
message: "introspection is disabled for role: \"introspection_disabled\""
query:
query: |
query {
__schema {
types {
name
}
}
}
- description: throw error when executing query with the '__type' field for a introspection disabled role
url: /v1/graphql
status: 200
headers:
X-Hasura-Role: introspection_disabled
response:
errors:
- extensions:
path: $
code: not-supported
message: "introspection is disabled for role: \"introspection_disabled\""
query:
query: |
query {
__type (name: "authors") {
fields {
name
}
}
}
- description: allow '__typename' in the query for a introspection disabled role
url: /v1/graphql
status: 200
headers:
X-Hasura-Role: introspection_disabled
response:
data:
__typename: query_root
authors:
- __typename: authors
name: J.K.Rowling
- __typename: authors
name: Paulo Coelho
query:
query: |
query {
__typename
authors {
__typename
name
}
}