export_sdl: avoid trailing space for scalar definitions

This has been introduced in 06973ee.

The problem can easily be avoided by modifying the `write!`
directives inside the federation if-clause to write space
prefixes instead of suffixes.
This commit is contained in:
Dominik Spicher 2022-08-22 10:06:21 +02:00
parent 9dd3ec894f
commit faf407b691

View File

@ -215,14 +215,14 @@ impl Registry {
if let Some(description) = description { if let Some(description) = description {
export_description(sdl, options, true, description); export_description(sdl, options, true, description);
} }
write!(sdl, "scalar {} ", name).ok(); write!(sdl, "scalar {}", name).ok();
if options.federation { if options.federation {
if *inaccessible { if *inaccessible {
write!(sdl, "@inaccessible ").ok(); write!(sdl, " @inaccessible").ok();
} }
for tag in *tags { for tag in *tags {
write!(sdl, "@tag(name: \"{}\") ", tag.replace('"', "\\\"")).ok(); write!(sdl, " @tag(name: \"{}\")", tag.replace('"', "\\\"")).ok();
} }
} }
writeln!(sdl).ok(); writeln!(sdl).ok();