public async Task OnExecute(CommandLineApplication app) { var showDoc = (await _showDocStore.GetAll()).FirstOrDefault(x => x.Name == Name); if (showDoc == null) { Console.WriteLine($"Not Found Project {Name}"); return; } try { var docStr = await HttpClient.GetStringAsync(showDoc.SwaggerUrl); var document = SwaggerParser.ParseString(docStr); var request = document.ToShowDocRequest(); foreach (var item in request) { await ShowDocClient.UpdateByApi(showDoc, item); } Console.WriteLine("Sync Successfully!"); } catch (Exception e) { Console.WriteLine($"Sync failed: {e.StackTrace}"); } }
public SwaggerParserV3_Tests() { _showdoc = new ShowDocEntity() { AppKey = "5b2451ec0a8b49f5323645e6d50d9b29557907599", AppToken = "170c09f45fe6e70642cc17c44ff9213f1222612682", ShowDocUrl = "https://www.showdoc.cc/server/api/item/updateByApi" }; var str = File.ReadAllText(AppContext.BaseDirectory + "swaggerDocsV3.json", Encoding.UTF8); _documentCoreV3 = SwaggerParser.ParseString(str) as SwaggerDocumentCoreV3; }
public SwaggerParserV2_Tests() { _showdoc = new ShowDocEntity() { AppKey = "a338fb0d83c6f4b660bc2706b92e89451844587564", AppToken = "e1511a84db06d25150377970f328e9f7572510835", ShowDocUrl = "https://www.showdoc.cc/server/api/item/updateByApi" }; var str = File.ReadAllText(AppContext.BaseDirectory + "swaggerDocsV2.json", Encoding.UTF8); _document = SwaggerParser.ParseString(str) as SwaggerDocumentCoreV2; }