Fixed an error in exporting Federation SDL.

This commit is contained in:
Sunli 2021-04-12 15:46:49 +08:00
parent 630739faeb
commit 5806682ad0

View File

@ -118,6 +118,21 @@ impl Registry {
return;
}
if name.as_str() == &self.query_type && federation {
let mut field_count = 0;
for field in fields.values() {
if field.name.starts_with("__")
|| (federation && matches!(&*field.name, "_service" | "_entities"))
{
continue;
}
field_count += 1;
}
if field_count == 0 {
return;
}
}
if description.is_some() {
writeln!(sdl, "\"\"\"\n{}\n\"\"\"", description.unwrap()).ok();
}