graphql-engine/server/tests-py/queries/remote_schemas/validation/field_validation.yaml
Karthikeyan Chinnakonda 3ea611f9fd
Server: Validate remote schema queries (#5938)
* [skip ci] use the args while making the fieldParser

* modify the execution part of the remote queries

* parse union queries deeply

* add test for remote schema field validation

* add tests for validating remote query arguments


Co-authored-by: Auke Booij <auke@hasura.io>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-10-13 14:03:11 +05:30

69 lines
1.6 KiB
YAML

- description: query the remote with a non-existing field 'non_existing_field', which should fail to validate
url: /v1/graphql
status: 200
query:
query: |
query {
user (id: 1) {
id
username
non_existing_field
}
}
response:
errors:
- extensions:
path: $.selectionSet.user.selectionSet.non_existing_field
code: validation-failed
message: "field \"non_existing_field\" not found in type: 'User'"
- description: query the remote with a non-existing field in an interface type
url: /v1/graphql
status: 200
query:
query: |
{
hero(episode: 4) {
id
name
... on Droid {
id
name
primaryFunction
non_existing_field
}
}
}
response:
errors:
- extensions:
path: $.selectionSet.hero.selectionSet.non_existing_field
code: validation-failed
message: "field \"non_existing_field\" not found in type: 'Droid'"
- description: query the remote with a non-existing field in an union type
url: /v1/graphql
status: 200
query:
query: |
{
search(episode: 2) {
__typename
... on Droid {
id
name
}
... on Human {
id
name
non_existing_field
}
}
}
response:
errors:
- extensions:
path: $.selectionSet.search.selectionSet.non_existing_field
code: validation-failed
message: "field \"non_existing_field\" not found in type: 'Human'"