From 933a818afb51928067d62f605c065a6b68985100 Mon Sep 17 00:00:00 2001 From: Sunli Date: Fri, 10 Jun 2022 18:55:12 +0800 Subject: [PATCH] Fixes #946 --- src/registry/mod.rs | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/src/registry/mod.rs b/src/registry/mod.rs index 5cbc542c..30700d98 100644 --- a/src/registry/mod.rs +++ b/src/registry/mod.rs @@ -606,6 +606,25 @@ impl Registry { }) .collect(); + if let MetaType::Object { fields, .. } = self.types.get_mut(&self.query_type).unwrap() { + fields.insert( + "_service".to_string(), + MetaField { + name: "_service".to_string(), + description: None, + args: Default::default(), + ty: "_Service!".to_string(), + deprecation: Default::default(), + cache_control: Default::default(), + external: false, + requires: None, + provides: None, + visible: None, + compute_complexity: None, + }, + ); + } + if !possible_types.is_empty() { self.types.insert( "_Entity".to_string(), @@ -618,25 +637,7 @@ impl Registry { }, ); - let query_root = self.types.get_mut(&self.query_type).unwrap(); - if let MetaType::Object { fields, .. } = query_root { - fields.insert( - "_service".to_string(), - MetaField { - name: "_service".to_string(), - description: None, - args: Default::default(), - ty: "_Service!".to_string(), - deprecation: Default::default(), - cache_control: Default::default(), - external: false, - requires: None, - provides: None, - visible: None, - compute_complexity: None, - }, - ); - + if let MetaType::Object { fields, .. } = self.types.get_mut(&self.query_type).unwrap() { fields.insert( "_entities".to_string(), MetaField {