private List <LogKeyValueItem> GenerateEndpoints(List <ApiOperationSchemaMap> operationSchemaMappings)
        {
            if (operationSchemaMappings == null)
            {
                throw new ArgumentNullException(nameof(operationSchemaMappings));
            }

            var sgEndpoints = new List <SyntaxGeneratorEndpointControllers>();

            foreach (var segmentName in projectOptions.BasePathSegmentNames)
            {
                var generator = new SyntaxGeneratorEndpointControllers(projectOptions, operationSchemaMappings, segmentName);
                generator.GenerateCode();
                sgEndpoints.Add(generator);
            }

            var logItems = new List <LogKeyValueItem>();

            foreach (var sg in sgEndpoints)
            {
                logItems.Add(sg.ToFile());
            }

            return(logItems);
        }
Пример #2
0
    private void GenerateEndpoints(
        List <ApiOperationSchemaMap> operationSchemaMappings)
    {
        ArgumentNullException.ThrowIfNull(operationSchemaMappings);

        var sgEndpoints = new List <SyntaxGeneratorEndpointControllers>();

        foreach (var segmentName in projectOptions.BasePathSegmentNames)
        {
            var generator = new SyntaxGeneratorEndpointControllers(logger, projectOptions, operationSchemaMappings, segmentName);
            generator.GenerateCode();
            sgEndpoints.Add(generator);
        }

        foreach (var sg in sgEndpoints)
        {
            sg.ToFile();
        }
    }