学习Source Generators之从swagger中生成类
前面学习了一些Source Generators的基础只是,接下来就来实践一下,用这个来生成我们所需要的代码。本文将通过读取swagger.json的内容,解析并生成对应的请求响应类的代码。
创建项目
首先还是先创建两个项目,一个控制台程序,一个类库。
https://img2024.cnblogs.com/blog/1313665/202404/1313665-20240402095036356-1315273326.png
添加swagger文件
在控制台程序中添加Files目录,并把swagger文件放进去。别忘了还需要添加AdditionalFiles。
<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>
实现ClassFromSwaggerGenerator
安装依赖
由于我们需要解析swagger,所以需要安装一下JSON相关的包。这里我们安装了Newtonsoft.Json。
需要注意的是,依赖第三方包的时候需要在项目文件添加下面内容:
<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>$(GetTargetPathDependsOn);GetDependencyTargetPaths<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>否则编译时会出现FileNotFound的异常。
构建管道
这里我们通过AdditionalTextsProvider筛选以及过滤我们的swagger文件。
var pipeline = context.AdditionalTextsProvider.Select(static (text, cancellationToken) =><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>{<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>if (!text.Path.EndsWith("swagger.json", StringComparison.OrdinalIgnoreCase))<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>{<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>return default;<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>}<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>return JObject.Parse(text.GetText(cancellationToken)!.ToString());<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>})<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>.Where((pair) => pair is not null);实现生成代码逻辑
接下来我们就解析Swagger中的内容,并且动态拼接代码内容。主要代码部分如下:
context.RegisterSourceOutput(pipeline, static (context, swagger) => {<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup> List sources = new List();<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup> #region 生成实体<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup> var schemas = (JObject)swagger["components"]!["schemas"]!;<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup> foreach (JProperty item in schemas.Properties())<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup> {<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup> if (item != null)<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup> {<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup> sources.Add((HandleClassName(item.Name), $@"#nullable enableusing System;using System.Collections.Generic;namespace SwaggerEntities;public {ClassOrEnum((JObject)item.Value)} {HandleClassName(item.Name)} {{<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>{BuildProperty((JObject)item.Value)}}}"));<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup> }<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup> }<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup> foreach (var (name, sourceString) in sources)<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup> {<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup> var sourceText = SourceText.From(sourceString, Encoding.UTF8);<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup> context.AddSource($"{name}.g.cs", sourceText);<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup> }<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup> #endregion<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup> });完整的代码如下:
using Microsoft.CodeAnalysis;using Microsoft.CodeAnalysis.Text;using Newtonsoft.Json;using Newtonsoft.Json.Linq;using System;using System.Collections.Generic;using System.Diagnostics;using System.IO;using System.Linq;using System.Text;namespace GenerateClassFromSwagger.Analysis{<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>public class ClassFromSwaggerGenerator : IIncrementalGenerator<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>{<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>public void Initialize(IncrementalGeneratorInitializationContext context)<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>{<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>var pipeline = context.AdditionalTextsProvider.Select(static (text, cancellationToken) =><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>{<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>if (!text.Path.EndsWith("swagger.json", StringComparison.OrdinalIgnoreCase))<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>{<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>return default;<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>}<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>return JObject.Parse(text.GetText(cancellationToken)!.ToString());<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>})<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>.Where((pair) => pair is not null);<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>context.RegisterSourceOutput(pipeline, static (context, swagger) =><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>{<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>List sources = new List();<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>#region 生成实体<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>var schemas = (JObject)swagger["components"]!["schemas"]!;<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>foreach (JProperty item in schemas.Properties())<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>{<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>if (item != null)<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>{<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>sources.Add((HandleClassName(item.Name), $@"#nullable enableusing System;using System.Collections.Generic;namespace SwaggerEntities;public {ClassOrEnum((JObject)item.Value)} {HandleClassName(item.Name)} {{<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>{BuildProperty((JObject)item.Value)}}}<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>"));<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>}<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>}<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>foreach (var (name, sourceString) in sources)<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>{<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>var sourceText = SourceText.From(sourceString, Encoding.UTF8);<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>context.AddSource($"{name}.g.cs", sourceText);<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>}<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>#endregion<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>});<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>}<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>static string HandleClassName(string name)<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>{<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>return name.Split('.').Last().Replace("", "").Replace(",", "");<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>}<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>static string ClassOrEnum(JObject value)<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>{<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>return value.ContainsKey("enum") ? "enum" : "partial class";<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>}<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>static string BuildProperty(JObject value)<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>{<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>var sb = new StringBuilder();<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>if (value.ContainsKey("properties"))<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>{<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>var propertys = (JObject)value["properties"]!;<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>foreach (JProperty item in propertys!.Properties())<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>{<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>sb.AppendLine($@"<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>public {BuildProertyType((JObject)item.Value)} {ToUpperFirst(item.Name)}<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>{{ get; set; }}");<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>}<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>}<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>if (value.ContainsKey("enum"))<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>{<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>foreach (var item in JsonConvert.DeserializeObject(value["enum"]!.ToString())!)<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>{<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>sb.Append($@"<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>_{item},");<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>}<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>sb.Remove(sb.Length - 1, 1);<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>}<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>return sb.ToString();<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>}<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>static string BuildProertyType(JObject value)<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>{<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>;<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>var type = GetType(value);<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>var nullable = value.ContainsKey("nullable") ? value["nullable"]!.Value() switch<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>{<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>true => "?",<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>false => "",<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>_ => ""<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>} : "";<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>return type + nullable;<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>}<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>static string GetType(JObject value)<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>{<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>return value.ContainsKey("type") ? value["type"]!.Value() switch<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>{<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>"string" => "string",<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>"boolean" => "bool",<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>"number" => value["format"]!.Value() == "float" ? "float" : "double",<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>"integer" => value["format"]!.Value() == "int32" ? "int" : "long",<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>"array" => ((JObject)value["items"]!).ContainsKey("items") ?<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>$"List"<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>: $"List",<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>"object" => value.ContainsKey("additionalProperties") ? $"Dictionary" : "object",<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>_ => "object"<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>} : value.ContainsKey("$ref") ? HandleClassName(value["$ref"]!.Value()!) : "object";<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>}<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>static unsafe string ToUpperFirst(string str)<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>{<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>if (str == null) return null;<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>string ret = string.Copy(str);<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>fixed (char* ptr = ret)<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>*ptr = char.ToUpper(*ptr);<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>return ret;<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>}<ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup><ItemGroup>
<AdditionalFiles Include="Files\swagger.json" />
</ItemGroup>}}详细的处理过程大家可以仔细看看代码,这里就不一一解释了。
启动编译
接下来编译控制台程序。编译成功后可以看到生成了很多cs的代码。若是看不见,可以重启VS。
点开一个文件,可以看到内容,并且在上方提示自动生成,无法编辑。
到这我们就完成了通过swagger来生成我们的请求和响应类的功能。
结语
本文章应用SourceGenerator,在编译时读取swagger.json的内容并解析,成功生成了我们API的请求和响应类的代码。
我们可以发现,代码生成没有问题,无法移动或者编辑生成的代码。
下一篇文章我们就来学习下如何输出SourceGenerator生成的代码文件到我们的文件目录。
本文代码仓库地址https://github.com/fanslead/Learn-SourceGenerator
来源:https://www.cnblogs.com/fanshaoO/p/18109928
免责声明:由于采集信息均来自互联网,如果侵犯了您的权益,请联系我们【E-Mail:cb@itdo.tech】 我们会及时删除侵权内容,谢谢合作!
页:
[1]