Пример #1
0
        internal static MemoryFileSystem GenerateCodeInto(this string inputFile, MemoryFileSystem fileSystem)
        {
            fileSystem.Copy(Path.Combine("Resource", inputFile));

            var settings = new Settings
            {
                Modeler         = "Swagger",
                CodeGenerator   = "CSharp",
                FileSystem      = fileSystem,
                OutputDirectory = "GeneratedCode",
                Input           = inputFile,
            };

            var     codeGenerator = new CSharpCodeGenerator(settings);
            Modeler modeler       = ExtensionsLoader.GetModeler(settings);
            var     sc            = modeler.Build();

            codeGenerator.NormalizeClientModel(sc);
            codeGenerator.Generate(sc).GetAwaiter().GetResult();

            return(fileSystem);
        }