public async Task Initialize(SwaggerReference info) { var swaggerDocumentLoader = new SwaggarDocumentLoader(_yamlSerializers, _httpClientFactory); var swaggerDocuments = new List <SwaggerDocument>(); var httpClient = _httpClientFactory.Create(null); foreach (var input in info.inputs) { if (string.IsNullOrEmpty(info.source)) { // TODO : re-abstract this case into docmgr using (var yamlReader = InnerPackage.OpenText(input)) { var swaggerDocument = _yamlSerializers.YamlDeserializer.Deserialize <SwaggerDocument>(yamlReader); swaggerDocuments.Add(swaggerDocument); } } else { var uriParts = UriParts.Parse(info.source); uriParts.RewriteGitHubUris(); var swaggerDocument = await swaggerDocumentLoader.LoadDocument(uriParts.ToString(), input); swaggerDocuments.Add(swaggerDocument); } } foreach (var swaggerDocument in swaggerDocuments) { foreach (var pathEntry in swaggerDocument.paths) { foreach (var operationEntry in pathEntry.Value.operations) { var context = new GenerateSingleRequestDefinitionContext { SwaggerReference = info, SwaggerDocument = swaggerDocument, SwaggarDocumentLoader = swaggerDocumentLoader, Path = pathEntry, Operation = operationEntry, }; _requestGenerator.GenerateSingleRequestDefinition(context); if (GeneratedFiles.ContainsKey(context.GeneratedPath)) { for (var index = 2; index != 200; ++index) { if (!GeneratedFiles.ContainsKey($"{context.GeneratedPath}.{index}")) { GeneratedFiles.Add( $"{context.GeneratedPath}.{index}", context.GeneratedContent); break; } } } else { GeneratedFiles.Add( context.GeneratedPath, context.GeneratedContent); } } } } }