From d07b303d31fdf0810f8be163bb3973c564cf0754 Mon Sep 17 00:00:00 2001 From: Rachel Smith Date: Tue, 17 Oct 2023 02:00:49 +1000 Subject: [PATCH] Fix for #64: return before error on missing fields (#73) * Use early return when there is no fieldDef * fix: reverse condition * chore: add changeset --------- Co-authored-by: Alessia Bellisario --- .changeset/five-spiders-protect.md | 5 +++++ src/language-server/errors/validation.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/five-spiders-protect.md diff --git a/.changeset/five-spiders-protect.md b/.changeset/five-spiders-protect.md new file mode 100644 index 00000000..0d224591 --- /dev/null +++ b/.changeset/five-spiders-protect.md @@ -0,0 +1,5 @@ +--- +"vscode-apollo": patch +--- + +Return early instead of erroring on missing fields diff --git a/src/language-server/errors/validation.ts b/src/language-server/errors/validation.ts index ab03372c..e5573bca 100644 --- a/src/language-server/errors/validation.ts +++ b/src/language-server/errors/validation.ts @@ -175,7 +175,7 @@ export function NoMissingClientDirectives(context: ValidationContext) { const fieldDef = context.getFieldDef(); // if we don't have a type to check then we can early return - if (!parentType) return; + if (!parentType || !fieldDef) return; // here we collect all of the fields on a type that are marked "local" const clientFields =