private List <LogKeyValueItem> GenerateEndpoints(List <ApiOperationSchemaMap> operationSchemaMappings) { if (operationSchemaMappings == null) { throw new ArgumentNullException(nameof(operationSchemaMappings)); } //// TODO: var sgEndpointInterfaces = new List<SyntaxGeneratorClientEndpointInterface>(); var sgEndpoints = new List <SyntaxGeneratorClientEndpoint>(); foreach (var basePathSegmentName in projectOptions.BasePathSegmentNames) { ////var generatorEndpointInterfaces = new SyntaxGeneratorClientEndpointInterfaces(apiProjectOptions, operationSchemaMappings, basePathSegmentName); ////var generatedEndpointInterfaces = generatorEndpointInterfaces.GenerateSyntaxTrees(); ////sgEndpointInterfaces.AddRange(generatedEndpointInterfaces); var generatorEndpoints = new SyntaxGeneratorClientEndpoints(apiProjectOptions, operationSchemaMappings, basePathSegmentName); var generatedEndpoints = generatorEndpoints.GenerateSyntaxTrees(); sgEndpoints.AddRange(generatedEndpoints); } var logItems = new List <LogKeyValueItem>(); ////foreach (var sg in sgEndpointInterfaces) ////{ //// logItems.Add(sg.ToFile()); ////} foreach (var sg in sgEndpoints) { logItems.Add(sg.ToFile()); } return(logItems); }
private void GenerateEndpoints( List <ApiOperationSchemaMap> operationSchemaMappings) { ArgumentNullException.ThrowIfNull(operationSchemaMappings); var sgEndpointResults = new List <SyntaxGeneratorClientEndpointResult>(); var sgEndpointInterfaces = new List <SyntaxGeneratorClientEndpointInterface>(); var sgEndpoints = new List <SyntaxGeneratorClientEndpoint>(); foreach (var basePathSegmentName in projectOptions.BasePathSegmentNames) { var generatorEndpointResults = new SyntaxGeneratorClientEndpointResults(logger, apiProjectOptions, operationSchemaMappings, basePathSegmentName); var generatedEndpointResults = generatorEndpointResults.GenerateSyntaxTrees(); sgEndpointResults.AddRange(generatedEndpointResults); var generatorEndpointInterfaces = new SyntaxGeneratorClientEndpointInterfaces(logger, apiProjectOptions, operationSchemaMappings, basePathSegmentName); var generatedEndpointInterfaces = generatorEndpointInterfaces.GenerateSyntaxTrees(); sgEndpointInterfaces.AddRange(generatedEndpointInterfaces); var generatorEndpoints = new SyntaxGeneratorClientEndpoints(logger, apiProjectOptions, operationSchemaMappings, basePathSegmentName); var generatedEndpoints = generatorEndpoints.GenerateSyntaxTrees(); sgEndpoints.AddRange(generatedEndpoints); } foreach (var sg in sgEndpointResults) { sg.ToFile(); } foreach (var sg in sgEndpointInterfaces) { sg.ToFile(); } foreach (var sg in sgEndpoints) { sg.ToFile(); } }