Reduce redundancy in schema generation code

This commit is contained in:
Ben C 2022-05-23 10:57:17 -04:00 committed by GitHub
parent d69c6b117c
commit 031e8b99bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -22,14 +22,11 @@ public static class SchemaExporter
FlattenInheritanceHierarchy = true, FlattenInheritanceHierarchy = true,
AllowReferencesWithProperties = true AllowReferencesWithProperties = true
}; };
Console.WriteLine("Outputting Body Schema");
var bodySchema = new Schema<PlanetConfig>("Celestial Body Schema", $"{folderName}/body_schema", settings); var bodySchema = new Schema<PlanetConfig>("Celestial Body Schema", $"{folderName}/body_schema", settings);
bodySchema.Output(); bodySchema.Output();
Console.WriteLine("Outputting Star System Schema");
var systemSchema = var systemSchema =
new Schema<StarSystemConfig>("Star System Schema", $"{folderName}/star_system_schema", settings); new Schema<StarSystemConfig>("Star System Schema", $"{folderName}/star_system_schema", settings);
systemSchema.Output(); systemSchema.Output();
Console.WriteLine("Outputting Translation Schema");
var translationSchema = var translationSchema =
new Schema<TranslationConfig>("Translation Schema", $"{folderName}/translation_schema", settings); new Schema<TranslationConfig>("Translation Schema", $"{folderName}/translation_schema", settings);
translationSchema.Output(); translationSchema.Output();
@ -51,6 +48,7 @@ public static class SchemaExporter
public void Output() public void Output()
{ {
Console.WriteLine($"Outputting {_title}");
File.WriteAllText($"{_outFileName}.json", ToString()); File.WriteAllText($"{_outFileName}.json", ToString());
} }