private static void Main(string[] args) { var redownloadCoreSpecification = false; var downloadBranch = DownloadBranch; var answer = "invalid"; while (answer != "y" && answer != "n" && answer != "") { Console.Write("Download online rest specifications? [Y/N] (default N): "); answer = Console.ReadLine()?.Trim().ToLowerInvariant(); redownloadCoreSpecification = answer == "y"; } if (redownloadCoreSpecification) { Console.Write($"Branch to download specification from (default {downloadBranch}): "); var readBranch = Console.ReadLine()?.Trim(); if (!string.IsNullOrEmpty(readBranch)) { downloadBranch = readBranch; } } else { // read last downloaded branch from file. if (File.Exists(CodeConfiguration.LastDownloadedVersionFile)) { downloadBranch = File.ReadAllText(CodeConfiguration.LastDownloadedVersionFile); } } if (string.IsNullOrEmpty(downloadBranch)) { downloadBranch = DownloadBranch; } if (redownloadCoreSpecification) { RestSpecDownloader.Download(downloadBranch); } ApiGenerator.Generate(downloadBranch, "Ccr", "Core", "Graph", "Ilm", "Indices", "Info", "License", "MachineLearning", "Migration", "Monitoring", "Rollup", "Security", "Sql", "Ssl", "Watcher"); }
private static void Main(string[] args) { var redownloadCoreSpecification = false; var generateCode = false; var downloadBranch = DownloadBranch; var answer = "invalid"; while (answer != "y" && answer != "n" && answer != "") { Console.Write("Download online rest specifications? [y/N] (default N): "); answer = Console.ReadLine()?.Trim().ToLowerInvariant(); redownloadCoreSpecification = answer == "y"; } if (redownloadCoreSpecification) { Console.Write($"Branch to download specification from (default {downloadBranch}): "); var readBranch = Console.ReadLine()?.Trim(); if (!string.IsNullOrEmpty(readBranch)) { downloadBranch = readBranch; } } else { // read last downloaded branch from file. if (File.Exists(CodeConfiguration.LastDownloadedVersionFile)) { downloadBranch = File.ReadAllText(CodeConfiguration.LastDownloadedVersionFile); } } if (string.IsNullOrEmpty(downloadBranch)) { downloadBranch = DownloadBranch; } if (redownloadCoreSpecification) { RestSpecDownloader.Download(downloadBranch); } answer = "invalid"; while (answer != "y" && answer != "n" && answer != "") { Console.Write("Generate code from the specification files on disk? [Y/n] (default Y): "); answer = Console.ReadLine()?.Trim().ToLowerInvariant(); generateCode = answer == "y" || answer == ""; } if (generateCode) { ApiGenerator.Generate(downloadBranch, "Core", "XPack"); } }
// ReSharper disable once UnusedParameter.Local private static async Task Main(string[] args) { var redownloadCoreSpecification = Ask("Download online rest specifications?", false); var downloadBranch = DownloadBranch; if (redownloadCoreSpecification) { Console.Write($"Branch to download specification from (default {downloadBranch}): "); var readBranch = Console.ReadLine()?.Trim(); if (!string.IsNullOrEmpty(readBranch)) { downloadBranch = readBranch; } } else { // read last downloaded branch from file. if (File.Exists(GeneratorLocations.LastDownloadedVersionFile)) { downloadBranch = File.ReadAllText(GeneratorLocations.LastDownloadedVersionFile); } } if (string.IsNullOrEmpty(downloadBranch)) { downloadBranch = DownloadBranch; } var generateCode = Ask("Generate code from the specification files on disk?", defaultAnswer: true); var lowLevelOnly = generateCode && Ask("Generate low level client only?", defaultAnswer: false); if (redownloadCoreSpecification) { RestSpecDownloader.Download(downloadBranch); } if (generateCode) { var spec = Generator.ApiGenerator.CreateRestApiSpecModel(downloadBranch, "Core", "XPack"); if (!lowLevelOnly) { foreach (var endpoint in spec.Endpoints.Select(e => e.Value.FileName)) { if (CodeConfiguration.IsNewHighLevelApi(endpoint) && Ask($"Generate highlevel code for new api {endpoint}", false)) { CodeConfiguration.EnableHighLevelCodeGen.Add(endpoint); } } } await Generator.ApiGenerator.Generate(downloadBranch, lowLevelOnly, spec); } }
static void Main(string[] args) { bool redownloadCoreSpecification = false; string downloadBranch = DownloadBranch; var answer = "invalid"; while (answer != "y" && answer != "n" && answer != "") { Console.Write("Download online rest specifications? [Y/N] (default N): "); answer = Console.ReadLine()?.Trim().ToLowerInvariant(); redownloadCoreSpecification = answer == "y"; } if (redownloadCoreSpecification) { Console.Write("Branch to download specification from (default master): "); var readBranch = Console.ReadLine()?.Trim(); if (!string.IsNullOrEmpty(readBranch)) { downloadBranch = readBranch; } } else { // read last downloaded branch from file. if (File.Exists(CodeConfiguration.LastDownloadedVersionFile)) { downloadBranch = File.ReadAllText(CodeConfiguration.LastDownloadedVersionFile); } } if (string.IsNullOrEmpty(downloadBranch)) { downloadBranch = DownloadBranch; } if (redownloadCoreSpecification) { RestSpecDownloader.Download(downloadBranch); } ApiGenerator.Generate(downloadBranch, "Core", "Graph", "License", "Security", "Watcher"); //ApiGenerator.Generate(); //generates everything under ApiSpecification }
// ReSharper disable once UnusedParameter.Local private static async Task Main(string[] args) { var redownloadCoreSpecification = Ask("Download online rest specifications?", false); var downloadBranch = DownloadBranch; if (redownloadCoreSpecification) { Console.Write($"Branch to download specification from (default {downloadBranch}): "); var readBranch = Console.ReadLine()?.Trim(); if (!string.IsNullOrEmpty(readBranch)) { downloadBranch = readBranch; } } else { // read last downloaded branch from file. if (File.Exists(GeneratorLocations.LastDownloadedVersionFile)) { downloadBranch = File.ReadAllText(GeneratorLocations.LastDownloadedVersionFile); } } if (string.IsNullOrEmpty(downloadBranch)) { downloadBranch = DownloadBranch; } var generateCode = Ask("Generate code from the specification files on disk?", true); var lowLevelOnly = generateCode && Ask("Generate low level client only?", false); if (redownloadCoreSpecification) { RestSpecDownloader.Download(downloadBranch); } if (generateCode) { await Generator.ApiGenerator.Generate(downloadBranch, lowLevelOnly, "Core", "XPack"); } }