Export sdl for interface to implements another interface.
@@ -129,20 +129,7 @@ impl Registry {
write!(sdl, "extend ").ok();
}
write!(sdl, "type {} ", name).ok();
- if let Some(implements) = self.implements.get(name) {
- if !implements.is_empty() {
- write!(
- sdl,
- "implements {} ",
- implements
- .iter()
- .map(AsRef::as_ref)
- .collect::<Vec<&str>>()
- .join(" & ")
- )
- .ok();
- }
- }
+ self.write_implements(sdl, name);
if federation {
if let Some(keys) = keys {
@@ -178,6 +165,8 @@ impl Registry {
}
}
}
+ self.write_implements(sdl, name);
+
writeln!(sdl, "{{").ok();
Self::export_fields(sdl, fields.values(), federation);
writeln!(sdl, "}}").ok();
@@ -234,6 +223,23 @@ impl Registry {
}
}
}
+
+ fn write_implements(&self, sdl: &mut String, name: &str) {
+ if let Some(implements) = self.implements.get(name) {
+ if !implements.is_empty() {
+ write!(
+ sdl,
+ "implements {} ",
+ implements
+ .iter()
+ .map(AsRef::as_ref)
+ .collect::<Vec<&str>>()
+ .join(" & ")
+ )
+ .ok();
+ }
+ }
+ }
}
fn export_input_value(input_value: &MetaInputValue) -> String {
