示例#1
0
        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 async Task SwaggerToShowdoc_Test()
        {
            var request = _documentCoreV3.ToShowDocRequest();

            foreach (var item in request)
            {
                var res = await ShowDocClient.UpdateByApi(_showdoc, item);
            }
        }