mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-17 12:31:52 +03:00
d66d2d81fd
### 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
16 lines
393 B
YAML
16 lines
393 B
YAML
description: In schemas with at least one available query, the placeholder query should not be present.
|
|
url: /v1/graphql
|
|
status: 200
|
|
response:
|
|
errors:
|
|
- extensions:
|
|
code: validation-failed
|
|
path: $.selectionSet.no_queries_available
|
|
message: |-
|
|
field "no_queries_available" not found in type: 'query_root'
|
|
query:
|
|
query: |
|
|
query {
|
|
no_queries_available
|
|
}
|