graphql-engine/server/tests-py/queries/graphql_query/empty/select_placeholder.yaml
Antoine Leblanc d66d2d81fd server: use placeholder to prevent empty query roots
### Description

The GraphQL spec has to conflicting requirements:
1. an object must contain at least one field: the schema may not contain empty objects
2. the _query_root_ must always be present

Given _1_, the schema generation code removes from the schema all fields that would result in empty objects, such as a table for which a user does not have select permissions. But, as a result, our code also potentially removes _query_root_ if it is empty, breaking _2_.

This PR introduces a dummy "placeholder" field in the query root if it's empty, to ensure we never remove it from the schema.

### Remaining work

- [x] changelog entry
- [x] tests

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/148
GitOrigin-RevId: bfd6bfcc2f3de92900b6ba566012f093399ca037
2022-01-27 18:08:11 +00:00

12 lines
360 B
YAML

description: Empty schemas have a placeholder query.
url: /v1/graphql
status: 200
response:
data:
no_queries_available: "There are no queries available to the current role. Either there are no sources or remote schemas configured, or the current role doesn't have the required permissions."
query:
query: |
query {
no_queries_available
}