diff --git a/.gitignore b/.gitignore index a688ea4..c67256b 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ dist/ node_modules/ *.user +*.lscache msbuild.binlog package-lock.json acg.js diff --git a/ApiCodeGenerator.code-workspace b/ApiCodeGenerator.code-workspace deleted file mode 100644 index 8154fa4..0000000 --- a/ApiCodeGenerator.code-workspace +++ /dev/null @@ -1,14 +0,0 @@ -{ - "folders": [ - { - "path": "." - }, - { - "path": "src/ApiCodeGenerator.Npm" - } - ], - "settings": { - "autoHide.hideSideBarsOnDebug": false, - "autoHide.hidePanelOnDebug": false - } -} diff --git a/src/ApiCodeGenerator.MSBuild/Console/GenerateCommand.cs b/src/ApiCodeGenerator.MSBuild/Console/GenerateCommand.cs index 9f70407..f8301d7 100644 --- a/src/ApiCodeGenerator.MSBuild/Console/GenerateCommand.cs +++ b/src/ApiCodeGenerator.MSBuild/Console/GenerateCommand.cs @@ -72,7 +72,7 @@ private async Task ExecuteAsync(InvocationContext context) private IGenerationTaskFactory GetGenerationTaskFactory(string? nswagToolsPath) { - var context = new AssemblyLoadContext("Generator Context"); + var context = AssemblyLoadContext.GetLoadContext(Assembly.GetCallingAssembly())!; // регистриуем процесс резолва сборок AssemblyResolver.Register(context); diff --git a/src/ApiCodeGenerator.MSBuild/build/ApiCodeGenerator.MSBuild.props b/src/ApiCodeGenerator.MSBuild/build/ApiCodeGenerator.MSBuild.props index f094f73..f844165 100644 --- a/src/ApiCodeGenerator.MSBuild/build/ApiCodeGenerator.MSBuild.props +++ b/src/ApiCodeGenerator.MSBuild/build/ApiCodeGenerator.MSBuild.props @@ -39,11 +39,11 @@ <_Temporary1 Include="@(_Temporary)"> %(DocumentDir)%(FileName).yml - %(FullPath) + %(Identity) <_Temporary1 Include="@(_Temporary)"> %(DocumentDir)%(FileName).yaml - %(FullPath) + %(Identity) <_OpenApiReference Include="@(_Temporary1 -> '%(OpenApiPath)')" diff --git a/src/ApiCodeGenerator.MSBuild/build/Console.targets b/src/ApiCodeGenerator.MSBuild/build/Console.targets index a3c4b38..3fbc383 100644 --- a/src/ApiCodeGenerator.MSBuild/build/Console.targets +++ b/src/ApiCodeGenerator.MSBuild/build/Console.targets @@ -126,17 +126,18 @@ <_AcgDotnetRuntimes Remove="@(_AcgDotnetRuntimes)" Condition="!$([System.String]::new('%(Identity)').StartsWith('Microsoft.NETCore.App '))" /> - <_AcgRuntimes Include="$(__AcgToolsDir)**\ApiCodeGenerator.MSBuild.exe" /> + <_AcgRuntimes Include="$(__AcgToolsDir)**\ApiCodeGenerator.MSBuild.dll" /> <_AcgRuntimes Include="$([System.IO.Path]::GetFileName($([System.IO.Path]::GetDirectoryName(%(_AcgRuntimes.Identity)))))"> $([System.IO.Path]::GetDirectoryName(%(_AcgRuntimes.Identity))) - <_AcgRuntimes Remove="$(__AcgToolsDir)**\ApiCodeGenerator.MSBuild.exe" /> + <_AcgRuntimes Remove="netstandard2.0" /> + <_AcgRuntimes Remove="$(__AcgToolsDir)**\ApiCodeGenerator.MSBuild.dll" /> - <_AcgNswagRuntimes Include="$(NSwagDir)../**/dotnet-nswag.exe" /> + <_AcgNswagRuntimes Include="$(NSwagDir)../**/dotnet-nswag.dll" /> <_AcgNswagRuntimes Include="$([System.IO.Path]::GetFileName($([System.IO.Path]::GetDirectoryName(%(_AcgNswagRuntimes.Identity)))))"> $([System.IO.Path]::GetDirectoryName(%(_AcgNswagRuntimes.Identity))) - <_AcgNswagRuntimes Remove="$(NSwagDir)../**/dotnet-nswag.exe" /> + <_AcgNswagRuntimes Remove="$(NSwagDir)../**/dotnet-nswag.dll" /> diff --git a/src/ApiCodeGenerator.OpenApi/CSharpClientContentGenerator.cs b/src/ApiCodeGenerator.OpenApi/CSharpClientContentGenerator.cs index 9861841..93aee32 100644 --- a/src/ApiCodeGenerator.OpenApi/CSharpClientContentGenerator.cs +++ b/src/ApiCodeGenerator.OpenApi/CSharpClientContentGenerator.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Threading.Tasks; using NSwag.CodeGeneration.CSharp; @@ -6,7 +6,7 @@ namespace ApiCodeGenerator.OpenApi { internal sealed class CSharpClientContentGenerator - : ContentGeneratorBase + : CSharpContentGenerator { } } diff --git a/src/ApiCodeGenerator.OpenApi/CSharpControllerContentGenerator.cs b/src/ApiCodeGenerator.OpenApi/CSharpControllerContentGenerator.cs index 7755a09..44eb2d0 100644 --- a/src/ApiCodeGenerator.OpenApi/CSharpControllerContentGenerator.cs +++ b/src/ApiCodeGenerator.OpenApi/CSharpControllerContentGenerator.cs @@ -6,7 +6,7 @@ namespace ApiCodeGenerator.OpenApi { internal sealed class CSharpControllerContentGenerator - : ContentGeneratorBase + : CSharpContentGenerator { } } diff --git a/src/ApiCodeGenerator.OpenApi/TypeScriptClientContentGenerator.cs b/src/ApiCodeGenerator.OpenApi/TypeScriptClientContentGenerator.cs index a8e0a87..bfa515c 100644 --- a/src/ApiCodeGenerator.OpenApi/TypeScriptClientContentGenerator.cs +++ b/src/ApiCodeGenerator.OpenApi/TypeScriptClientContentGenerator.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Threading.Tasks; using NJsonSchema.CodeGeneration; @@ -15,6 +15,10 @@ public override string Generate() => Generator.GenerateFile(); protected override TypeResolverBase CreateTypeResolver(TypeScriptClientGeneratorSettings settings, OpenApiDocument apiDocument) - => new TypeScriptTypeResolver(settings.TypeScriptGeneratorSettings); + { + var resolver = new TypeScriptTypeResolver(settings.TypeScriptGeneratorSettings); + resolver.RegisterSchemaDefinitions(apiDocument.Definitions); + return resolver; + } } } diff --git a/src/Sdk/NpmPack.targets b/src/Sdk/NpmPack.targets index dae2d29..b093bd1 100644 --- a/src/Sdk/NpmPack.targets +++ b/src/Sdk/NpmPack.targets @@ -70,7 +70,9 @@ module.exports = dlls;" /> PackagePath="$([System.IO.Path]::Combine('binaries', '%(_PackageFiles.TargetPath)'))" Condition="'%(_PackageFiles.Tools)' == 'true'" /> - + diff --git a/src/Sdk/Sdk.props b/src/Sdk/Sdk.props index bf80689..ba2aae5 100644 --- a/src/Sdk/Sdk.props +++ b/src/Sdk/Sdk.props @@ -15,7 +15,4 @@ - - - diff --git a/src/Sdk/Sdk.targets b/src/Sdk/Sdk.targets index ae25925..ec5a6f3 100644 --- a/src/Sdk/Sdk.targets +++ b/src/Sdk/Sdk.targets @@ -1,4 +1,4 @@ - + @@ -36,6 +36,16 @@ + + + + + + + + + +