From 8e22f91b9704aba53e5c9c7391efc014055f6ee7 Mon Sep 17 00:00:00 2001 From: Markus Podar Date: Wed, 14 Apr 2021 19:49:12 +0200 Subject: [PATCH] Update README --- README.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/README.md b/README.md index 73575e6b..e70e113e 100644 --- a/README.md +++ b/README.md @@ -131,6 +131,7 @@ To work this around: - [Default field resolver](#default-field-resolver) - [Macros](#macros) - [Automatic Persisted Queries support](#automatic-persisted-queries-support) + - [Misc features](#misc-features) - [Guides](#guides) - [Upgrading from v1 to v2](#upgrading-from-v1-to-v2) - [Migrating from Folklore](#migrating-from-folklore) @@ -2492,6 +2493,36 @@ const app = new Vue({ ``` +## Misc features + +### Detecting unused variables + +By default, `'variables'` provided alongside the GraphQL query which are **not** +consumed, are silently ignored. + +If you consider the hypothetical case you have an optional (nullable) argument +in your query, and you provide a variable argument for it but you make a typo, +this can go unnoticed. + +Example: +```graphql +mutation test($value:ID) { + someMutation(type:"falbala", optional_id: $value) +} +``` +Variables provided: +```json5 +{ + // Ops! typo in `values` + "values": "138" +} +``` + +In this case, nothing happens and `optional_id` will be treated as not being provided. + +To prevent such scenarios, you can enable the config option `detect_unused_variables` +and set it to `true`. + ## Guides ### Upgrading from v1 to v2