From c6ffb688d169b915fa670f445d1c38066d3464ad Mon Sep 17 00:00:00 2001 From: Marko Lahma Date: Tue, 10 May 2022 19:08:32 +0300 Subject: [PATCH] Change supported target frameworks * upgrade from net461 to net462 * drop support for net40, net45 * drop support for < netstandard2.0 * drop netcoreapp2.1, netcoreapp3.1 and net5.0 * upgrade NUKE * switch back to using windows-latest GH Actions image which now has NET 6 support --- .github/workflows/build.yml | 23 +- .github/workflows/pr.yml | 23 +- .nuke/build.schema.json | 9 +- build.ps1 | 2 +- build.sh | 2 +- build/Build.CI.GitHubActions.cs | 13 +- build/Build.cs | 39 +- build/_build.csproj | 15 +- samples/Samples.sln | 13 +- .../Sample.AspNetCore21.Nginx/.dockerignore | 10 - .../Controllers/ValuesController.cs | 45 - .../Sample.AspNetCore21.Nginx/Dockerfile | 19 - .../Sample.AspNetCore21.Nginx/Program.cs | 17 - .../Properties/launchSettings.json | 34 - .../Sample.AspNetCore21.Nginx.csproj | 28 - .../Sample.AspNetCore21.Nginx.sln | 37 - .../Sample.AspNetCore21.Nginx/Startup.cs | 83 -- .../docker-compose.dcproj | 18 - .../docker-compose.override.yml | 8 - .../docker-compose.yml | 14 - .../Sample.AspNetCore21.Nginx/nginx.conf | 30 - .../Clients.generated.cs | 61 +- .../Clients.generated.cs | 348 +++++++ .../Sample.AspNetCore60.Client.csproj} | 1 + .../Controllers/WeatherForecastController.cs | 0 .../Program.cs | 0 .../Properties/launchSettings.json | 2 +- .../README.md | 8 +- .../Sample.AspNetCore60.csproj} | 6 +- .../Startup.cs | 0 .../WeatherForecast.cs | 0 .../appsettings.Development.json | 0 .../appsettings.json | 0 .../nswag.json | 6 +- .../openapi.json | 2 +- .../Sample.NetOwinMiddleware.csproj | 83 +- .../Sample.NetOwinMiddleware/Web.config | 27 +- .../Sample.NetOwinMiddleware/packages.config | 21 - .../appsettings.Development.json | 9 - .../Sample.AspNetCore21/appsettings.json | 8 - .../nswag_assembly_swagger.json | 152 --- .../Controllers/ValuesController.cs | 0 .../Program.cs | 0 .../Properties/launchSettings.json | 0 .../Sample.AspNetCore60.csproj} | 6 +- .../Startup.cs | 4 +- .../appsettings.Development.json | 0 .../Sample.AspNetCore60}/appsettings.json | 0 .../nswag_assembly.nswag | 2 +- .../nswag_project.nswag | 4 +- .../nswag_project_swagger.json | 0 .../nswag_reflection.nswag | 2 +- .../nswag_reflection_swagger.json | 0 .../NSwag.Annotations.csproj | 5 +- .../NSwag.ApiDescription.Client.targets | 2 - .../NSwag.AspNet.Owin.csproj | 11 +- .../NSwag.AspNet.WebApi.csproj | 5 +- .../NSwag.AspNetCore.Launcher.x86.csproj | 2 +- .../NSwag.AspNetCore.Launcher.csproj | 6 +- src/NSwag.AspNetCore/NSwag.AspNetCore.csproj | 14 +- src/NSwag.AspNetCore/NSwag.AspNetCore.nuspec | 45 +- .../NSwag.AssemblyLoader.Tests.csproj | 2 +- .../NSwag.AssemblyLoader.csproj | 4 +- .../NSwag.CodeGeneration.CSharp.Tests.csproj | 5 +- .../Properties/launchSettings.json | 12 + .../NSwag.CodeGeneration.CSharp.csproj | 4 +- .../NSwag.CodeGeneration.Tests.csproj | 3 +- ...wag.CodeGeneration.TypeScript.Tests.csproj | 5 +- .../Properties/launchSettings.json | 12 + .../NSwag.CodeGeneration.TypeScript.csproj | 4 +- .../NSwag.CodeGeneration.csproj | 4 +- .../AspNetCore/AspNetCoreToOpenApiCommand.cs | 2 +- .../Commands/IsolatedCommandBase.cs | 4 +- src/NSwag.Commands/HostApplication.cs | 2 +- src/NSwag.Commands/NSwag.Commands.csproj | 28 +- src/NSwag.Commands/NSwagDocument.cs | 21 +- src/NSwag.Commands/NSwagDocumentBase.cs | 2 +- src/NSwag.Commands/Runtime.cs | 9 - src/NSwag.Commands/RuntimeUtilities.cs | 19 +- .../NSwag.Console.x86.csproj | 5 +- src/NSwag.Console/NSwag.Console.csproj | 11 +- .../NSwag.ConsoleCore.csproj | 19 +- src/NSwag.Core.Tests/NSwag.Core.Tests.csproj | 2 +- .../NSwag.Core.Yaml.Tests.csproj | 2 +- src/NSwag.Core.Yaml/NSwag.Core.Yaml.csproj | 2 +- src/NSwag.Core/NSwag.Core.csproj | 10 +- src/NSwag.Demo.Web/NSwag.Demo.Web.csproj | 2 +- ...wag.Generation.AspNetCore.Tests.Web.csproj | 12 +- .../Startup.cs | 30 +- .../AspNetCoreToSwaggerGenerationTests.cs | 897 ------------------ .../NSwag.Generation.AspNetCore.Tests.csproj | 17 +- .../NSwag.Generation.AspNetCore.csproj | 18 +- .../NSwag.Generation.Tests.csproj | 2 +- .../NSwag.Generation.WebApi.csproj | 4 +- src/NSwag.Generation/NSwag.Generation.csproj | 4 +- .../NSwag.Integration.ClientPCL.csproj | 2 +- .../NSwag.Integration.Console.csproj | 2 +- .../package-lock.json | 231 ++++- .../NSwag.Integration.WebAPI.csproj | 2 +- src/NSwag.MSBuild/NSwag.MSBuild.nuspec | 17 +- src/NSwag.MSBuild/NSwag.MSBuild.props | 6 - src/NSwag.Min.sln | 63 -- src/NSwag.Npm/README.md | 12 - src/NSwag.Npm/bin/nswag.js | 8 - src/NSwag.Npm/package-lock.json | 18 +- .../NSwag.Sample.Common.csproj | 2 +- .../Controllers/ValuesController.cs | 66 -- .../NSwag.Sample.NET50.csproj | 13 - src/NSwag.Sample.NET50/Program.cs | 20 - .../Properties/launchSettings.json | 27 - src/NSwag.Sample.NET50/Startup.cs | 65 -- .../appsettings.Development.json | 9 - src/NSwag.Sample.NET50/appsettings.json | 9 - src/NSwag.Sample.NET50/nswag.json | 58 -- src/NSwag.Sample.NET50/openapi.json | 215 ----- .../NSwag.Sample.NETCore20.Part.csproj | 8 - .../SampleController.cs | 14 - .../NSwag.Sample.NETCore20.csproj | 21 - .../Output/swagger_new_v2.json | 601 ------------ .../Output/swagger_new_v3.json | 728 -------------- .../Output/swagger_old_v2.json | 501 ---------- .../Output/swagger_old_v3.json | 619 ------------ src/NSwag.Sample.NETCore20/Program.cs | 18 - .../Properties/launchSettings.json | 29 - src/NSwag.Sample.NETCore20/Startup.cs | 123 --- .../Update-SwaggerSpecs.ps1 | 18 - .../appsettings.Development.json | 10 - src/NSwag.Sample.NETCore20/appsettings.json | 15 - src/NSwag.Sample.NETCore20/nswag.json | 59 -- src/NSwag.Sample.NETCore20/swagger.json | 758 --------------- .../Controllers/PetController.cs | 161 ---- .../NSwag.Sample.NETCore21.csproj | 30 - src/NSwag.Sample.NETCore21/Program.cs | 24 - .../Properties/launchSettings.json | 30 - src/NSwag.Sample.NETCore21/Startup.cs | 58 -- .../appsettings.Development.json | 9 - src/NSwag.Sample.NETCore21/appsettings.json | 7 - .../nswag_assembly.nswag | 59 -- .../nswag_project.nswag | 57 -- src/NSwag.Sample.NETCore21/oldswagger.json | 376 -------- src/NSwag.Sample.NETCore21/swagger.json | 514 ---------- .../swagger_assembly_cli.json | 563 ----------- .../swagger_project_cli.json | 562 ----------- .../Controllers/ValuesController.cs | 66 -- .../NSwag.Sample.NETCore31.csproj | 17 - src/NSwag.Sample.NETCore31/Program.cs | 20 - .../Properties/launchSettings.json | 30 - src/NSwag.Sample.NETCore31/Startup.cs | 60 -- .../appsettings.Development.json | 9 - src/NSwag.Sample.NETCore31/appsettings.json | 9 - src/NSwag.Sample.NETCore31/nswag.json | 58 -- src/NSwag.Sample.NETCore31/openapi.json | 215 ----- ...NSwag.Sample.NetCoreAngular.Clients.csproj | 2 +- .../NSwag.Sample.NetCoreAngular.csproj | 3 +- src/NSwag.Sample.NetCoreAngular/Startup.cs | 17 +- src/NSwag.Sample.NetCoreAngular/nswag.json | 2 +- .../NSwag.Sample.NetCoreAurelia.csproj | 5 +- src/NSwag.Sample.NetCoreAurelia/Startup.cs | 17 +- src/NSwag.Sample.NetCoreAurelia/nswag.json | 2 +- .../NSwag.Sample.NetGlobalAsax.csproj | 2 +- src/NSwag.VersionMissmatchTest/App.config | 2 +- .../NSwag.VersionMissmatchTest.csproj | 2 +- src/NSwag.sln | 105 -- src/NSwagStudio/App.config | 2 +- src/NSwagStudio/NSwagStudio.csproj | 2 +- src/NSwagStudio/nswag.cmd | 18 +- 166 files changed, 866 insertions(+), 9119 deletions(-) delete mode 100644 samples/WithMiddleware/Sample.AspNetCore21.Nginx/.dockerignore delete mode 100644 samples/WithMiddleware/Sample.AspNetCore21.Nginx/Controllers/ValuesController.cs delete mode 100644 samples/WithMiddleware/Sample.AspNetCore21.Nginx/Dockerfile delete mode 100644 samples/WithMiddleware/Sample.AspNetCore21.Nginx/Program.cs delete mode 100644 samples/WithMiddleware/Sample.AspNetCore21.Nginx/Properties/launchSettings.json delete mode 100644 samples/WithMiddleware/Sample.AspNetCore21.Nginx/Sample.AspNetCore21.Nginx.csproj delete mode 100644 samples/WithMiddleware/Sample.AspNetCore21.Nginx/Sample.AspNetCore21.Nginx.sln delete mode 100644 samples/WithMiddleware/Sample.AspNetCore21.Nginx/Startup.cs delete mode 100644 samples/WithMiddleware/Sample.AspNetCore21.Nginx/docker-compose.dcproj delete mode 100644 samples/WithMiddleware/Sample.AspNetCore21.Nginx/docker-compose.override.yml delete mode 100644 samples/WithMiddleware/Sample.AspNetCore21.Nginx/docker-compose.yml delete mode 100644 samples/WithMiddleware/Sample.AspNetCore21.Nginx/nginx.conf create mode 100644 samples/WithMiddleware/Sample.AspNetCore60.Client/Clients.generated.cs rename samples/WithMiddleware/{Sample.AspNetCore31.Client/Sample.AspNetCore31.Client.csproj => Sample.AspNetCore60.Client/Sample.AspNetCore60.Client.csproj} (86%) rename samples/WithMiddleware/{Sample.AspNetCore31 => Sample.AspNetCore60}/Controllers/WeatherForecastController.cs (100%) rename samples/WithMiddleware/{Sample.AspNetCore31 => Sample.AspNetCore60}/Program.cs (100%) rename samples/WithMiddleware/{Sample.AspNetCore31 => Sample.AspNetCore60}/Properties/launchSettings.json (96%) rename samples/WithMiddleware/{Sample.AspNetCore31 => Sample.AspNetCore60}/README.md (53%) rename samples/WithMiddleware/{Sample.AspNetCore31/Sample.AspNetCore31.csproj => Sample.AspNetCore60/Sample.AspNetCore60.csproj} (63%) rename samples/WithMiddleware/{Sample.AspNetCore31 => Sample.AspNetCore60}/Startup.cs (100%) rename samples/WithMiddleware/{Sample.AspNetCore31 => Sample.AspNetCore60}/WeatherForecast.cs (100%) rename samples/WithMiddleware/{Sample.AspNetCore31 => Sample.AspNetCore60}/appsettings.Development.json (100%) rename samples/WithMiddleware/{Sample.AspNetCore31 => Sample.AspNetCore60}/appsettings.json (100%) rename samples/WithMiddleware/{Sample.AspNetCore31 => Sample.AspNetCore60}/nswag.json (97%) rename samples/WithMiddleware/{Sample.AspNetCore31 => Sample.AspNetCore60}/openapi.json (93%) delete mode 100644 samples/WithMiddleware/Sample.NetOwinMiddleware/packages.config delete mode 100644 samples/WithoutMiddleware/Sample.AspNetCore21/appsettings.Development.json delete mode 100644 samples/WithoutMiddleware/Sample.AspNetCore21/appsettings.json delete mode 100644 samples/WithoutMiddleware/Sample.AspNetCore21/nswag_assembly_swagger.json rename samples/WithoutMiddleware/{Sample.AspNetCore21 => Sample.AspNetCore60}/Controllers/ValuesController.cs (100%) rename samples/WithoutMiddleware/{Sample.AspNetCore21 => Sample.AspNetCore60}/Program.cs (100%) rename samples/WithoutMiddleware/{Sample.AspNetCore21 => Sample.AspNetCore60}/Properties/launchSettings.json (100%) rename samples/WithoutMiddleware/{Sample.AspNetCore21/Sample.AspNetCore21.csproj => Sample.AspNetCore60/Sample.AspNetCore60.csproj} (70%) rename samples/WithoutMiddleware/{Sample.AspNetCore21 => Sample.AspNetCore60}/Startup.cs (88%) rename samples/{WithMiddleware/Sample.AspNetCore21.Nginx => WithoutMiddleware/Sample.AspNetCore60}/appsettings.Development.json (100%) rename samples/{WithMiddleware/Sample.AspNetCore21.Nginx => WithoutMiddleware/Sample.AspNetCore60}/appsettings.json (100%) rename samples/WithoutMiddleware/{Sample.AspNetCore21 => Sample.AspNetCore60}/nswag_assembly.nswag (96%) rename samples/WithoutMiddleware/{Sample.AspNetCore21 => Sample.AspNetCore60}/nswag_project.nswag (96%) rename samples/WithoutMiddleware/{Sample.AspNetCore21 => Sample.AspNetCore60}/nswag_project_swagger.json (100%) rename samples/WithoutMiddleware/{Sample.AspNetCore21 => Sample.AspNetCore60}/nswag_reflection.nswag (96%) rename samples/WithoutMiddleware/{Sample.AspNetCore21 => Sample.AspNetCore60}/nswag_reflection_swagger.json (100%) create mode 100644 src/NSwag.CodeGeneration.CSharp.Tests/Properties/launchSettings.json create mode 100644 src/NSwag.CodeGeneration.TypeScript.Tests/Properties/launchSettings.json delete mode 100644 src/NSwag.Generation.AspNetCore.Tests/AspNetCoreToSwaggerGenerationTests.cs delete mode 100644 src/NSwag.Sample.NET50/Controllers/ValuesController.cs delete mode 100644 src/NSwag.Sample.NET50/NSwag.Sample.NET50.csproj delete mode 100644 src/NSwag.Sample.NET50/Program.cs delete mode 100644 src/NSwag.Sample.NET50/Properties/launchSettings.json delete mode 100644 src/NSwag.Sample.NET50/Startup.cs delete mode 100644 src/NSwag.Sample.NET50/appsettings.Development.json delete mode 100644 src/NSwag.Sample.NET50/appsettings.json delete mode 100644 src/NSwag.Sample.NET50/nswag.json delete mode 100644 src/NSwag.Sample.NET50/openapi.json delete mode 100644 src/NSwag.Sample.NETCore20.Part/NSwag.Sample.NETCore20.Part.csproj delete mode 100644 src/NSwag.Sample.NETCore20.Part/SampleController.cs delete mode 100644 src/NSwag.Sample.NETCore20/NSwag.Sample.NETCore20.csproj delete mode 100644 src/NSwag.Sample.NETCore20/Output/swagger_new_v2.json delete mode 100644 src/NSwag.Sample.NETCore20/Output/swagger_new_v3.json delete mode 100644 src/NSwag.Sample.NETCore20/Output/swagger_old_v2.json delete mode 100644 src/NSwag.Sample.NETCore20/Output/swagger_old_v3.json delete mode 100644 src/NSwag.Sample.NETCore20/Program.cs delete mode 100644 src/NSwag.Sample.NETCore20/Properties/launchSettings.json delete mode 100644 src/NSwag.Sample.NETCore20/Startup.cs delete mode 100644 src/NSwag.Sample.NETCore20/Update-SwaggerSpecs.ps1 delete mode 100644 src/NSwag.Sample.NETCore20/appsettings.Development.json delete mode 100644 src/NSwag.Sample.NETCore20/appsettings.json delete mode 100644 src/NSwag.Sample.NETCore20/nswag.json delete mode 100644 src/NSwag.Sample.NETCore20/swagger.json delete mode 100644 src/NSwag.Sample.NETCore21/Controllers/PetController.cs delete mode 100644 src/NSwag.Sample.NETCore21/NSwag.Sample.NETCore21.csproj delete mode 100644 src/NSwag.Sample.NETCore21/Program.cs delete mode 100644 src/NSwag.Sample.NETCore21/Properties/launchSettings.json delete mode 100644 src/NSwag.Sample.NETCore21/Startup.cs delete mode 100644 src/NSwag.Sample.NETCore21/appsettings.Development.json delete mode 100644 src/NSwag.Sample.NETCore21/appsettings.json delete mode 100644 src/NSwag.Sample.NETCore21/nswag_assembly.nswag delete mode 100644 src/NSwag.Sample.NETCore21/nswag_project.nswag delete mode 100644 src/NSwag.Sample.NETCore21/oldswagger.json delete mode 100644 src/NSwag.Sample.NETCore21/swagger.json delete mode 100644 src/NSwag.Sample.NETCore21/swagger_assembly_cli.json delete mode 100644 src/NSwag.Sample.NETCore21/swagger_project_cli.json delete mode 100644 src/NSwag.Sample.NETCore31/Controllers/ValuesController.cs delete mode 100644 src/NSwag.Sample.NETCore31/NSwag.Sample.NETCore31.csproj delete mode 100644 src/NSwag.Sample.NETCore31/Program.cs delete mode 100644 src/NSwag.Sample.NETCore31/Properties/launchSettings.json delete mode 100644 src/NSwag.Sample.NETCore31/Startup.cs delete mode 100644 src/NSwag.Sample.NETCore31/appsettings.Development.json delete mode 100644 src/NSwag.Sample.NETCore31/appsettings.json delete mode 100644 src/NSwag.Sample.NETCore31/nswag.json delete mode 100644 src/NSwag.Sample.NETCore31/openapi.json diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 04defd78d7..0503c32328 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,28 +28,13 @@ on: - '!**/*.md' jobs: - windows-2022: - name: windows-2022 - runs-on: windows-2022 + windows-latest: + name: windows-latest + runs-on: windows-latest steps: - name: 'Allow long file path' run: git config --system core.longpaths true - - uses: actions/checkout@v1 - - uses: actions/setup-dotnet@v3 - with: - dotnet-version: 2.1.* - - uses: actions/setup-dotnet@v3 - with: - dotnet-version: 3.1.* - - uses: actions/setup-dotnet@v3 - with: - dotnet-version: 5.0.* - - uses: actions/setup-dotnet@v3 - with: - dotnet-version: 6.0.* - - uses: actions/setup-dotnet@v3 - with: - dotnet-version: 7.0.* + - uses: actions/checkout@v2 - name: Cache .nuke/temp, ~/.nuget/packages uses: actions/cache@v2 with: diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 2749d79c85..099bff3500 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -26,28 +26,13 @@ on: - '!**/*.md' jobs: - windows-2022: - name: windows-2022 - runs-on: windows-2022 + windows-latest: + name: windows-latest + runs-on: windows-latest steps: - name: 'Allow long file path' run: git config --system core.longpaths true - - uses: actions/checkout@v1 - - uses: actions/setup-dotnet@v3 - with: - dotnet-version: 2.1.* - - uses: actions/setup-dotnet@v3 - with: - dotnet-version: 3.1.* - - uses: actions/setup-dotnet@v3 - with: - dotnet-version: 5.0.* - - uses: actions/setup-dotnet@v3 - with: - dotnet-version: 6.0.* - - uses: actions/setup-dotnet@v3 - with: - dotnet-version: 7.0.* + - uses: actions/checkout@v2 - name: Cache .nuke/temp, ~/.nuget/packages uses: actions/cache@v2 with: diff --git a/.nuke/build.schema.json b/.nuke/build.schema.json index 0a1b38ef2e..6bbf90c422 100644 --- a/.nuke/build.schema.json +++ b/.nuke/build.schema.json @@ -8,7 +8,7 @@ "properties": { "ChocoApiKey": { "type": "string", - "default": "Secrets must be entered via 'nuke :secret [profile]'" + "default": "Secrets must be entered via 'nuke :secrets [profile]'" }, "Configuration": { "type": "string", @@ -33,6 +33,7 @@ "AppVeyor", "AzurePipelines", "Bamboo", + "Bitbucket", "Bitrise", "GitHubActions", "GitLab", @@ -48,7 +49,7 @@ }, "MyGetApiKey": { "type": "string", - "default": "Secrets must be entered via 'nuke :secret [profile]'" + "default": "Secrets must be entered via 'nuke :secrets [profile]'" }, "NoLogo": { "type": "boolean", @@ -56,11 +57,11 @@ }, "NpmAuthToken": { "type": "string", - "default": "Secrets must be entered via 'nuke :secret [profile]'" + "default": "Secrets must be entered via 'nuke :secrets [profile]'" }, "NuGetApiKey": { "type": "string", - "default": "Secrets must be entered via 'nuke :secret [profile]'" + "default": "Secrets must be entered via 'nuke :secrets [profile]'" }, "Partition": { "type": "string", diff --git a/build.ps1 b/build.ps1 index 1c774e5254..8c52d631ce 100644 --- a/build.ps1 +++ b/build.ps1 @@ -63,7 +63,7 @@ else { $env:DOTNET_EXE = "$DotNetDirectory\dotnet.exe" } -Write-Output "Microsoft (R) .NET Core SDK version $(& $env:DOTNET_EXE --version)" +Write-Output "Microsoft (R) .NET SDK version $(& $env:DOTNET_EXE --version)" ExecSafe { & $env:DOTNET_EXE build $BuildProjectFile /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet } ExecSafe { & $env:DOTNET_EXE run --project $BuildProjectFile --no-build -- $BuildArguments } diff --git a/build.sh b/build.sh index e8961f9988..1f3ba09e20 100755 --- a/build.sh +++ b/build.sh @@ -56,7 +56,7 @@ else export DOTNET_EXE="$DOTNET_DIRECTORY/dotnet" fi -echo "Microsoft (R) .NET Core SDK version $("$DOTNET_EXE" --version)" +echo "Microsoft (R) .NET SDK version $("$DOTNET_EXE" --version)" "$DOTNET_EXE" build "$BUILD_PROJECT_FILE" /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet "$DOTNET_EXE" run --project "$BUILD_PROJECT_FILE" --no-build -- "$@" diff --git a/build/Build.CI.GitHubActions.cs b/build/Build.CI.GitHubActions.cs index 3805c4bb54..e8ff27a26f 100644 --- a/build/Build.CI.GitHubActions.cs +++ b/build/Build.CI.GitHubActions.cs @@ -6,7 +6,7 @@ [CustomGitHubActionsAttribute( "pr", - GitHubActionsImage.WindowsServer2022, + GitHubActionsImage.WindowsLatest, // GitHubActionsImage.UbuntuLatest, // GitHubActionsImage.MacOsLatest, OnPullRequestBranches = new[] { "master", "main" }, @@ -18,7 +18,7 @@ ] [CustomGitHubActionsAttribute( "build", - GitHubActionsImage.WindowsServer2022, + GitHubActionsImage.WindowsLatest, // GitHubActionsImage.UbuntuLatest, // GitHubActionsImage.MacOsLatest, OnPushBranches = new[] { "master", "main" }, @@ -45,14 +45,7 @@ protected override GitHubActionsJob GetJobs(GitHubActionsImage image, IReadOnlyC var job = base.GetJobs(image, relevantTargets); var newSteps = new List(job.Steps); - foreach (var version in new[] { "7.0.*", "6.0.*", "5.0.*", "3.1.*", "2.1.*" }) - { - newSteps.Insert(1, new GitHubActionsSetupDotNetStep - { - Version = version - }); - } - + newSteps.Insert(0, new GitHubActionsConfigureLongPathsStep()); job.Steps = newSteps.ToArray(); diff --git a/build/Build.cs b/build/Build.cs index b99152b57c..226f179a4d 100644 --- a/build/Build.cs +++ b/build/Build.cs @@ -6,7 +6,6 @@ using Microsoft.Build.Evaluation; using Microsoft.Build.Locator; using Nuke.Common; -using Nuke.Common.Execution; using Nuke.Common.Git; using Nuke.Common.IO; using Nuke.Common.ProjectModel; @@ -18,7 +17,6 @@ using Nuke.Common.Utilities.Collections; using static Nuke.Common.IO.FileSystemTasks; -using static Nuke.Common.Logger; using static Nuke.Common.Tooling.ProcessTasks; using static Nuke.Common.Tools.Chocolatey.ChocolateyTasks; using static Nuke.Common.Tools.DotNet.DotNetTasks; @@ -27,7 +25,6 @@ using static Nuke.Common.Tools.VSTest.VSTestTasks; using Project = Nuke.Common.ProjectModel.Project; -[CheckBuildProjectConfigurations] partial class Build : NukeBuild { public Build() @@ -61,6 +58,7 @@ public Build() [GitRepository] readonly GitRepository GitRepository; AbsolutePath SourceDirectory => RootDirectory / "src"; + AbsolutePath SamplesDirectory => RootDirectory / "samples"; AbsolutePath ArtifactsDirectory => RootDirectory / "artifacts"; AbsolutePath NSwagStudioBinaries => SourceDirectory / "NSwagStudio" / "bin" / Configuration; @@ -114,6 +112,7 @@ protected override void OnBuildInitialized() .Before(Restore) .Executes(() => { + SamplesDirectory.GlobDirectories("**/bin", "**/obj").ForEach(DeleteDirectory); SourceDirectory.GlobDirectories("**/bin", "**/obj").ForEach(DeleteDirectory); EnsureCleanDirectory(ArtifactsDirectory); }); @@ -124,7 +123,6 @@ protected override void OnBuildInitialized() .Executes(() => { Chocolatey("install wixtoolset -y"); - Chocolatey("install netfx-4.6.1-devpack -y"); NpmInstall(x => x .EnableGlobal() .AddPackages("dotnettools") @@ -174,7 +172,7 @@ protected override void OnBuildInitialized() .SetFileVersion(VersionPrefix) .SetInformationalVersion(VersionPrefix) .SetConfiguration(Configuration) - .SetMaxCpuCount(Environment.ProcessorCount) + .SetMaxCpuCount(1) // wix's heat has problems .SetNodeReuse(IsLocalBuild) .SetVerbosity(MSBuildVerbosity.Minimal) .SetProperty("Deterministic", IsServerBuild) @@ -235,9 +233,6 @@ protected override void OnBuildInitialized() // project name + runtime pairs var dotnetTargets = new[] { - ("NSwag.Sample.NETCore21", "NetCore21"), - ("NSwag.Sample.NETCore31", "NetCore31"), - ("NSwag.Sample.NET50", "Net50"), ("NSwag.Sample.NET60", "Net60"), ("NSwag.Sample.NET60Minimal", "Net60"), ("NSwag.Sample.NET70", "Net70"), @@ -321,13 +316,14 @@ void NSwagRun( var samplesPath = RootDirectory / "samples"; var sampleSolution = ProjectModelTasks.ParseSolution(samplesPath / "Samples.sln"); - NSwagRun(sampleSolution.GetProject("Sample.AspNetCore21"), "nswag_assembly", "NetCore21", Configuration.Release, true); - NSwagRun(sampleSolution.GetProject("Sample.AspNetCore21"), "nswag_project", "NetCore21", Configuration.Release, false); - NSwagRun(sampleSolution.GetProject("Sample.AspNetCore21"), "nswag_reflection", "NetCore21", Configuration.Release, true); - - NSwagRun(sampleSolution.GetProject("Sample.AspNetCore21"), "nswag_assembly", "NetCore21", Configuration.Debug, true); - NSwagRun(sampleSolution.GetProject("Sample.AspNetCore21"), "nswag_project", "NetCore21", Configuration.Debug, false); - NSwagRun(sampleSolution.GetProject("Sample.AspNetCore21"), "nswag_reflection", "NetCore21", Configuration.Debug, true); + var sampleProject = sampleSolution.GetProject(new Guid("55E2BF82-3ECE-45E2-96BD-65C09C42843D")); + NSwagRun(sampleProject, "nswag_assembly", "Net60", Configuration.Release, true); + NSwagRun(sampleProject, "nswag_project", "Net60", Configuration.Release, false); + NSwagRun(sampleProject, "nswag_reflection", "Net60", Configuration.Release, true); + + NSwagRun(sampleProject, "nswag_assembly", "Net60", Configuration.Debug, true); + NSwagRun(sampleProject, "nswag_project", "Net60", Configuration.Debug, false); + NSwagRun(sampleProject, "nswag_reflection", "Net60", Configuration.Debug, true); }); void PublishAndCopyConsoleProjects() @@ -355,23 +351,20 @@ void PublishConsoleProject(Nuke.Common.ProjectModel.Project project, string[] ta } } - PublishConsoleProject(consoleX86Project, new[] { "net461" }); - PublishConsoleProject(consoleProject, new[] { "net461" }); - PublishConsoleProject(consoleCoreProject, new[] { "netcoreapp2.1", "netcoreapp3.1", "net5.0", "net6.0", "net7.0" }); + PublishConsoleProject(consoleX86Project, new[] { "net462" }); + PublishConsoleProject(consoleProject, new[] { "net462" }); + PublishConsoleProject(consoleCoreProject, new[] { "net6.0", "net7.0" }); void CopyConsoleBinaries(AbsolutePath target) { // take just exe from X86 as other files are shared with console project - var consoleX86Directory = consoleX86Project.Directory / "bin" / Configuration / "net461" / "publish"; + var consoleX86Directory = consoleX86Project.Directory / "bin" / Configuration / "net462" / "publish"; CopyFileToDirectory(consoleX86Directory / "NSwag.x86.exe", target / "Win"); CopyFileToDirectory(consoleX86Directory / "NSwag.x86.exe.config", target / "Win"); - CopyDirectoryRecursively(consoleProject.Directory / "bin" / Configuration / "net461" / "publish", target / "Win", DirectoryExistsPolicy.Merge); + CopyDirectoryRecursively(consoleProject.Directory / "bin" / Configuration / "net462" / "publish", target / "Win", DirectoryExistsPolicy.Merge); var consoleCoreDirectory = consoleCoreProject.Directory / "bin" / Configuration; - CopyDirectoryRecursively(consoleCoreDirectory / "netcoreapp2.1" / "publish", target / "NetCore21"); - CopyDirectoryRecursively(consoleCoreDirectory / "netcoreapp3.1" / "publish", target / "NetCore31"); - CopyDirectoryRecursively(consoleCoreDirectory / "net5.0" / "publish", target / "Net50"); CopyDirectoryRecursively(consoleCoreDirectory / "net6.0" / "publish", target / "Net60"); CopyDirectoryRecursively(consoleCoreDirectory / "net7.0" / "publish", target / "Net70"); } diff --git a/build/_build.csproj b/build/_build.csproj index 7116cf2a71..f5acf9e11f 100644 --- a/build/_build.csproj +++ b/build/_build.csproj @@ -11,7 +11,7 @@ - + @@ -19,4 +19,17 @@ + + + + + + + + + + + + + diff --git a/samples/Samples.sln b/samples/Samples.sln index d5eedd5116..150b8cb0bf 100644 --- a/samples/Samples.sln +++ b/samples/Samples.sln @@ -3,9 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.29613.14 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample.AspNetCore20", "WithoutMiddleware\Sample.AspNetCore20\Sample.AspNetCore20.csproj", "{5A204483-5A44-4B80-8B0B-A58284CC4CCB}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample.AspNetCore21", "WithoutMiddleware\Sample.AspNetCore21\Sample.AspNetCore21.csproj", "{55E2BF82-3ECE-45E2-96BD-65C09C42843D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample.AspNetCore60", "WithoutMiddleware\Sample.AspNetCore60\Sample.AspNetCore60.csproj", "{55E2BF82-3ECE-45E2-96BD-65C09C42843D}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample.NetOwinMiddleware", "WithMiddleware\Sample.NetOwinMiddleware\Sample.NetOwinMiddleware.csproj", "{F8839807-B6F6-41E3-BC98-DFAD3C03085E}" EndProject @@ -13,9 +11,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WithMiddleware", "WithMiddl EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WithoutMiddleware", "WithoutMiddleware", "{BF07E900-C7DE-4ADA-8563-E09E6B5AACF0}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample.AspNetCore31", "WithMiddleware\Sample.AspNetCore31\Sample.AspNetCore31.csproj", "{2F6620B8-D19D-4710-AAB9-4E2B785F5FA5}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample.AspNetCore60", "WithMiddleware\Sample.AspNetCore60\Sample.AspNetCore60.csproj", "{2F6620B8-D19D-4710-AAB9-4E2B785F5FA5}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample.AspNetCore31.Client", "WithMiddleware\Sample.AspNetCore31.Client\Sample.AspNetCore31.Client.csproj", "{F9A962BB-9E7A-4FBD-9309-FF27A03856D6}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample.AspNetCore60.Client", "WithMiddleware\Sample.AspNetCore60.Client\Sample.AspNetCore60.Client.csproj", "{F9A962BB-9E7A-4FBD-9309-FF27A03856D6}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -23,10 +21,6 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {5A204483-5A44-4B80-8B0B-A58284CC4CCB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5A204483-5A44-4B80-8B0B-A58284CC4CCB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5A204483-5A44-4B80-8B0B-A58284CC4CCB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5A204483-5A44-4B80-8B0B-A58284CC4CCB}.Release|Any CPU.Build.0 = Release|Any CPU {55E2BF82-3ECE-45E2-96BD-65C09C42843D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {55E2BF82-3ECE-45E2-96BD-65C09C42843D}.Debug|Any CPU.Build.0 = Debug|Any CPU {55E2BF82-3ECE-45E2-96BD-65C09C42843D}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -48,7 +42,6 @@ Global HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {5A204483-5A44-4B80-8B0B-A58284CC4CCB} = {BF07E900-C7DE-4ADA-8563-E09E6B5AACF0} {55E2BF82-3ECE-45E2-96BD-65C09C42843D} = {BF07E900-C7DE-4ADA-8563-E09E6B5AACF0} {F8839807-B6F6-41E3-BC98-DFAD3C03085E} = {29EDA9F6-189B-4F96-B5BE-B7B82EB8A62A} {2F6620B8-D19D-4710-AAB9-4E2B785F5FA5} = {29EDA9F6-189B-4F96-B5BE-B7B82EB8A62A} diff --git a/samples/WithMiddleware/Sample.AspNetCore21.Nginx/.dockerignore b/samples/WithMiddleware/Sample.AspNetCore21.Nginx/.dockerignore deleted file mode 100644 index 43e8ab1e32..0000000000 --- a/samples/WithMiddleware/Sample.AspNetCore21.Nginx/.dockerignore +++ /dev/null @@ -1,10 +0,0 @@ -.dockerignore -.env -.git -.gitignore -.vs -.vscode -docker-compose.yml -docker-compose.*.yml -*/bin -*/obj diff --git a/samples/WithMiddleware/Sample.AspNetCore21.Nginx/Controllers/ValuesController.cs b/samples/WithMiddleware/Sample.AspNetCore21.Nginx/Controllers/ValuesController.cs deleted file mode 100644 index 6558a7839b..0000000000 --- a/samples/WithMiddleware/Sample.AspNetCore21.Nginx/Controllers/ValuesController.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; - -namespace SimpleApp.Controllers -{ - [Route("api/[controller]")] - [ApiController] - public class ValuesController : ControllerBase - { - // GET api/values - [HttpGet] - public ActionResult> Get() - { - return new string[] { "value1", "value2" }; - } - - // GET api/values/5 - [HttpGet("{id}")] - public ActionResult Get(int id) - { - return "value"; - } - - // POST api/values - [HttpPost] - public void Post([FromBody] string value) - { - } - - // PUT api/values/5 - [HttpPut("{id}")] - public void Put(int id, [FromBody] string value) - { - } - - // DELETE api/values/5 - [HttpDelete("{id}")] - public void Delete(int id) - { - } - } -} diff --git a/samples/WithMiddleware/Sample.AspNetCore21.Nginx/Dockerfile b/samples/WithMiddleware/Sample.AspNetCore21.Nginx/Dockerfile deleted file mode 100644 index a07cd16978..0000000000 --- a/samples/WithMiddleware/Sample.AspNetCore21.Nginx/Dockerfile +++ /dev/null @@ -1,19 +0,0 @@ -FROM mcr.microsoft.com/dotnet/core/aspnet:2.1-stretch-slim AS base -WORKDIR /app -EXPOSE 80 - -FROM mcr.microsoft.com/dotnet/core/sdk:2.1-stretch AS build -WORKDIR /src -COPY ["Sample.AspNetCore21.Nginx.csproj", "./"] -RUN dotnet restore "/Sample.AspNetCore21.Nginx.csproj" -COPY . . -WORKDIR "/src/" -RUN dotnet build "Sample.AspNetCore21.Nginx.csproj" -c Release -o /app - -FROM build AS publish -RUN dotnet publish "Sample.AspNetCore21.Nginx.csproj" -c Release -o /app - -FROM base AS final -WORKDIR /app -COPY --from=publish /app . -ENTRYPOINT ["dotnet", "Sample.AspNetCore21.Nginx.dll"] diff --git a/samples/WithMiddleware/Sample.AspNetCore21.Nginx/Program.cs b/samples/WithMiddleware/Sample.AspNetCore21.Nginx/Program.cs deleted file mode 100644 index 1c6d935076..0000000000 --- a/samples/WithMiddleware/Sample.AspNetCore21.Nginx/Program.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Microsoft.AspNetCore; -using Microsoft.AspNetCore.Hosting; - -namespace SimpleApp -{ - public class Program - { - public static void Main(string[] args) - { - CreateWebHostBuilder(args).Build().Run(); - } - - public static IWebHostBuilder CreateWebHostBuilder(string[] args) => - WebHost.CreateDefaultBuilder(args) - .UseStartup(); - } -} diff --git a/samples/WithMiddleware/Sample.AspNetCore21.Nginx/Properties/launchSettings.json b/samples/WithMiddleware/Sample.AspNetCore21.Nginx/Properties/launchSettings.json deleted file mode 100644 index e7efce453c..0000000000 --- a/samples/WithMiddleware/Sample.AspNetCore21.Nginx/Properties/launchSettings.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:59185/", - "sslPort": 0 - } - }, - "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "launchUrl": "swagger", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "SimpleApp": { - "commandName": "Project", - "launchBrowser": true, - "launchUrl": "swagger", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - }, - "applicationUrl": "http://localhost:59185/" - }, - "Docker": { - "commandName": "Docker", - "launchBrowser": true, - "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger" - } - } -} \ No newline at end of file diff --git a/samples/WithMiddleware/Sample.AspNetCore21.Nginx/Sample.AspNetCore21.Nginx.csproj b/samples/WithMiddleware/Sample.AspNetCore21.Nginx/Sample.AspNetCore21.Nginx.csproj deleted file mode 100644 index 752582a72c..0000000000 --- a/samples/WithMiddleware/Sample.AspNetCore21.Nginx/Sample.AspNetCore21.Nginx.csproj +++ /dev/null @@ -1,28 +0,0 @@ - - - netcoreapp2.1 - Linux - docker-compose.dcproj - Linux - - - - true - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/samples/WithMiddleware/Sample.AspNetCore21.Nginx/Sample.AspNetCore21.Nginx.sln b/samples/WithMiddleware/Sample.AspNetCore21.Nginx/Sample.AspNetCore21.Nginx.sln deleted file mode 100644 index 56053e22b5..0000000000 --- a/samples/WithMiddleware/Sample.AspNetCore21.Nginx/Sample.AspNetCore21.Nginx.sln +++ /dev/null @@ -1,37 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.28803.352 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample.AspNetCore21.Nginx", "Sample.AspNetCore21.Nginx.csproj", "{1D7FCD75-55BD-4D44-823B-AE3787BDE313}" -EndProject -Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{D3520430-6663-47A9-A7D1-ED43F33508BD}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NSwag.AspNetCore", "..\..\..\src\NSwag.AspNetCore\NSwag.AspNetCore.csproj", "{57BA5313-3983-4C01-ADD2-AB0CAFC02442}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {1D7FCD75-55BD-4D44-823B-AE3787BDE313}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1D7FCD75-55BD-4D44-823B-AE3787BDE313}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1D7FCD75-55BD-4D44-823B-AE3787BDE313}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1D7FCD75-55BD-4D44-823B-AE3787BDE313}.Release|Any CPU.Build.0 = Release|Any CPU - {D3520430-6663-47A9-A7D1-ED43F33508BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D3520430-6663-47A9-A7D1-ED43F33508BD}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D3520430-6663-47A9-A7D1-ED43F33508BD}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D3520430-6663-47A9-A7D1-ED43F33508BD}.Release|Any CPU.Build.0 = Release|Any CPU - {57BA5313-3983-4C01-ADD2-AB0CAFC02442}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {57BA5313-3983-4C01-ADD2-AB0CAFC02442}.Debug|Any CPU.Build.0 = Debug|Any CPU - {57BA5313-3983-4C01-ADD2-AB0CAFC02442}.Release|Any CPU.ActiveCfg = Release|Any CPU - {57BA5313-3983-4C01-ADD2-AB0CAFC02442}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {F4533C7E-C2A0-4845-9A3D-2408380AED4C} - EndGlobalSection -EndGlobal diff --git a/samples/WithMiddleware/Sample.AspNetCore21.Nginx/Startup.cs b/samples/WithMiddleware/Sample.AspNetCore21.Nginx/Startup.cs deleted file mode 100644 index 02173a88a1..0000000000 --- a/samples/WithMiddleware/Sample.AspNetCore21.Nginx/Startup.cs +++ /dev/null @@ -1,83 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.HttpOverrides; -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; - -namespace SimpleApp -{ - public class Startup - { - public Startup(IConfiguration configuration) - { - Configuration = configuration; - } - - public IConfiguration Configuration { get; } - - public void ConfigureServices(IServiceCollection services) - { - services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); - - services.Configure(options => - { - options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto; - }); - - services.AddOpenApiDocument(); - } - - public void Configure(IApplicationBuilder app, IHostingEnvironment env) - { - if (env.IsDevelopment()) - { - app.UseDeveloperExceptionPage(); - } - - app.UseMvc(); - - app.UseForwardedHeaders(new ForwardedHeadersOptions - { - ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto - }); - - app.UseAuthentication(); - app.UseMvc(); - - // There are two ways to run this app: - // 1. Run docker-compose and access http://localhost:8080/externalpath/swagger - // 2. Run Sample.AspNetCore21.Nginx and access http://localhost:59185/swagger/ - // both URLs should be correctly served... - - // Config with automatic proxy header handling (X-Forwarded-Host, X-Forwarded-Proto, X-Forwarded-Prefix, - app.UseOpenApi(); - app.UseSwaggerUi3(); - - // Config with custom proxy headers - //app.UseSwagger(config => - //{ - // config.Path = "/swagger/v1/swagger.json"; - // config.PostProcess = (document, request) => - // { - // if (request.Headers.ContainsKey("X-External-Host")) - // { - // // Change document server settings to public - // document.Host = request.Headers["X-External-Host"].First(); - // document.BasePath = request.Headers["X-External-Path"].First(); - // } - // }; - //}); - //app.UseSwaggerUi3(config => - //{ - // config.SwaggerRoute = "/swagger/v1/swagger.json"; - // config.TransformToExternalPath = (internalUiRoute, request) => - // { - // // The header X-External-Path is set in the nginx.conf file - // var externalPath = request.Headers.ContainsKey("X-External-Path") ? request.Headers["X-External-Path"].First() : ""; - // return externalPath + internalUiRoute; - // }; - //}); - } - } -} diff --git a/samples/WithMiddleware/Sample.AspNetCore21.Nginx/docker-compose.dcproj b/samples/WithMiddleware/Sample.AspNetCore21.Nginx/docker-compose.dcproj deleted file mode 100644 index 10d5296f7c..0000000000 --- a/samples/WithMiddleware/Sample.AspNetCore21.Nginx/docker-compose.dcproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - 2.1 - Linux - d3520430-6663-47a9-a7d1-ed43f33508bd - LaunchBrowser - {Scheme}://localhost:{ServicePort}/swagger - sampleaspnetcore21nginx - - - - docker-compose.yml - - - - - \ No newline at end of file diff --git a/samples/WithMiddleware/Sample.AspNetCore21.Nginx/docker-compose.override.yml b/samples/WithMiddleware/Sample.AspNetCore21.Nginx/docker-compose.override.yml deleted file mode 100644 index 3c0ce90690..0000000000 --- a/samples/WithMiddleware/Sample.AspNetCore21.Nginx/docker-compose.override.yml +++ /dev/null @@ -1,8 +0,0 @@ -version: '3.4' - -services: - sampleaspnetcore21nginx: - environment: - - ASPNETCORE_ENVIRONMENT=Development - ports: - - "80" diff --git a/samples/WithMiddleware/Sample.AspNetCore21.Nginx/docker-compose.yml b/samples/WithMiddleware/Sample.AspNetCore21.Nginx/docker-compose.yml deleted file mode 100644 index 3cd40c9e27..0000000000 --- a/samples/WithMiddleware/Sample.AspNetCore21.Nginx/docker-compose.yml +++ /dev/null @@ -1,14 +0,0 @@ -version: "3.4" -services: - sampleaspnetcore21nginx: - build: - context: . - dockerfile: Dockerfile - ports: - - "80" - reverseproxy: - image: nginx - volumes: - - ./nginx.conf:/etc/nginx/nginx.conf:ro - ports: - - "8080:80" \ No newline at end of file diff --git a/samples/WithMiddleware/Sample.AspNetCore21.Nginx/nginx.conf b/samples/WithMiddleware/Sample.AspNetCore21.Nginx/nginx.conf deleted file mode 100644 index 45a788ebd6..0000000000 --- a/samples/WithMiddleware/Sample.AspNetCore21.Nginx/nginx.conf +++ /dev/null @@ -1,30 +0,0 @@ -user nginx; -worker_processes 1; - -error_log /var/log/nginx/error.log warn; -pid /var/run/nginx.pid; - -events { - worker_connections 1024; -} - -http { - server { - listen 80; - listen [::]:80; - location /externalpath { - proxy_pass http://sampleaspnetcore21nginx; - rewrite ^/externalpath(.*)$ $1 break; - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection keep-alive; - proxy_set_header Host $host; - proxy_cache_bypass $http_upgrade; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - - proxy_set_header X-Forwarded-Host localhost:8080; - proxy_set_header X-Forwarded-Prefix /externalpath; - } - } -} \ No newline at end of file diff --git a/samples/WithMiddleware/Sample.AspNetCore31.Client/Clients.generated.cs b/samples/WithMiddleware/Sample.AspNetCore31.Client/Clients.generated.cs index 85a272eef8..59217dd15b 100644 --- a/samples/WithMiddleware/Sample.AspNetCore31.Client/Clients.generated.cs +++ b/samples/WithMiddleware/Sample.AspNetCore31.Client/Clients.generated.cs @@ -1,6 +1,6 @@ //---------------------- // -// Generated using the NSwag toolchain v13.8.2.0 (NJsonSchema v10.2.1.0 (Newtonsoft.Json v12.0.0.0)) (http://NSwag.org) +// Generated using the NSwag toolchain v13.14.5.0 (NJsonSchema v10.5.2.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org) // //---------------------- @@ -9,12 +9,14 @@ #pragma warning disable 472 // Disable "CS0472 The result of the expression is always 'false' since a value of type 'Int32' is never equal to 'null' of type 'Int32?' #pragma warning disable 1573 // Disable "CS1573 Parameter '...' has no matching param tag in the XML comment for ... #pragma warning disable 1591 // Disable "CS1591 Missing XML comment for publicly visible type or member ..." +#pragma warning disable 8073 // Disable "CS8073 The result of the expression is always 'false' since a value of type 'T' is never equal to 'null' of type 'T?'" +#pragma warning disable 3016 // Disable "CS3016 Arrays as attribute arguments is not CLS-compliant" namespace Apimundo.Client { using System = global::System; - - [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.8.2.0 (NJsonSchema v10.2.1.0 (Newtonsoft.Json v12.0.0.0))")] + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.14.5.0 (NJsonSchema v10.5.2.0 (Newtonsoft.Json v13.0.0.0))")] public partial class WeatherForecastClient { private System.Net.Http.HttpClient _httpClient; @@ -22,7 +24,7 @@ public partial class WeatherForecastClient public WeatherForecastClient(System.Net.Http.HttpClient httpClient) { - _httpClient = httpClient; + _httpClient = httpClient; _settings = new System.Lazy(CreateSerializerSettings); } @@ -36,10 +38,11 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() protected Newtonsoft.Json.JsonSerializerSettings JsonSerializerSettings { get { return _settings.Value; } } partial void UpdateJsonSerializerSettings(Newtonsoft.Json.JsonSerializerSettings settings); + + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); - /// A server side error occurred. public System.Threading.Tasks.Task> GetAsync() { @@ -63,8 +66,10 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); + var url_ = urlBuilder_.ToString(); request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + PrepareRequest(client_, request_, url_); var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); @@ -83,7 +88,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() var status_ = (int)response_.StatusCode; if (status_ == 200) { - var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_).ConfigureAwait(false); + var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); @@ -92,7 +97,7 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() } else { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } @@ -125,7 +130,7 @@ public ObjectResponseResult(T responseObject, string responseText) public bool ReadResponseAsString { get; set; } - protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers) + protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) { if (response == null || response.Content == null) { @@ -171,7 +176,7 @@ private string ConvertToString(object value, System.Globalization.CultureInfo cu { if (value == null) { - return null; + return ""; } if (value is System.Enum) @@ -190,7 +195,8 @@ private string ConvertToString(object value, System.Globalization.CultureInfo cu } } - return System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); + var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); + return converted == null ? string.Empty : converted; } } else if (value is bool) @@ -208,11 +214,11 @@ private string ConvertToString(object value, System.Globalization.CultureInfo cu } var result = System.Convert.ToString(value, cultureInfo); - return (result is null) ? string.Empty : result; + return result == null ? "" : result; } } - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.2.1.0 (Newtonsoft.Json v12.0.0.0)")] + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.5.2.0 (Newtonsoft.Json v13.0.0.0)")] public partial class WeatherForecast : System.ComponentModel.INotifyPropertyChanged { private System.DateTime _date; @@ -224,11 +230,11 @@ public partial class WeatherForecast : System.ComponentModel.INotifyPropertyChan public System.DateTime Date { get { return _date; } - set + set { if (_date != value) { - _date = value; + _date = value; RaisePropertyChanged(); } } @@ -238,11 +244,11 @@ public System.DateTime Date public int TemperatureC { get { return _temperatureC; } - set + set { if (_temperatureC != value) { - _temperatureC = value; + _temperatureC = value; RaisePropertyChanged(); } } @@ -252,11 +258,11 @@ public int TemperatureC public int TemperatureF { get { return _temperatureF; } - set + set { if (_temperatureF != value) { - _temperatureF = value; + _temperatureF = value; RaisePropertyChanged(); } } @@ -266,24 +272,24 @@ public int TemperatureF public string Summary { get { return _summary; } - set + set { if (_summary != value) { - _summary = value; + _summary = value; RaisePropertyChanged(); } } } - public string ToJson() + public string ToJson() { - return Newtonsoft.Json.JsonConvert.SerializeObject(this); + return Newtonsoft.Json.JsonConvert.SerializeObject(this, new Newtonsoft.Json.JsonSerializerSettings()); } public static WeatherForecast FromJson(string data) { - return Newtonsoft.Json.JsonConvert.DeserializeObject(data); + return Newtonsoft.Json.JsonConvert.DeserializeObject(data, new Newtonsoft.Json.JsonSerializerSettings()); } public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; @@ -297,7 +303,7 @@ protected virtual void RaisePropertyChanged([System.Runtime.CompilerServices.Cal } - [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.8.2.0 (NJsonSchema v10.2.1.0 (Newtonsoft.Json v12.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.14.5.0 (NJsonSchema v10.5.2.0 (Newtonsoft.Json v13.0.0.0))")] public partial class ApiException : System.Exception { public int StatusCode { get; private set; } @@ -310,7 +316,7 @@ public ApiException(string message, int statusCode, string response, System.Coll : base(message + "\n\nStatus: " + statusCode + "\nResponse: \n" + ((response == null) ? "(null)" : response.Substring(0, response.Length >= 512 ? 512 : response.Length)), innerException) { StatusCode = statusCode; - Response = response; + Response = response; Headers = headers; } @@ -320,7 +326,7 @@ public override string ToString() } } - [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.8.2.0 (NJsonSchema v10.2.1.0 (Newtonsoft.Json v12.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.14.5.0 (NJsonSchema v10.5.2.0 (Newtonsoft.Json v13.0.0.0))")] public partial class ApiException : ApiException { public TResult Result { get; private set; } @@ -338,4 +344,5 @@ public ApiException(string message, int statusCode, string response, System.Coll #pragma warning restore 1573 #pragma warning restore 472 #pragma warning restore 114 -#pragma warning restore 108 \ No newline at end of file +#pragma warning restore 108 +#pragma warning restore 3016 \ No newline at end of file diff --git a/samples/WithMiddleware/Sample.AspNetCore60.Client/Clients.generated.cs b/samples/WithMiddleware/Sample.AspNetCore60.Client/Clients.generated.cs new file mode 100644 index 0000000000..df233d381b --- /dev/null +++ b/samples/WithMiddleware/Sample.AspNetCore60.Client/Clients.generated.cs @@ -0,0 +1,348 @@ +//---------------------- +// +// Generated using the NSwag toolchain v13.14.5.0 (NJsonSchema v10.5.2.0 (Newtonsoft.Json v12.0.0.0)) (http://NSwag.org) +// +//---------------------- + +#pragma warning disable 108 // Disable "CS0108 '{derivedDto}.ToJson()' hides inherited member '{dtoBase}.ToJson()'. Use the new keyword if hiding was intended." +#pragma warning disable 114 // Disable "CS0114 '{derivedDto}.RaisePropertyChanged(String)' hides inherited member 'dtoBase.RaisePropertyChanged(String)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword." +#pragma warning disable 472 // Disable "CS0472 The result of the expression is always 'false' since a value of type 'Int32' is never equal to 'null' of type 'Int32?' +#pragma warning disable 1573 // Disable "CS1573 Parameter '...' has no matching param tag in the XML comment for ... +#pragma warning disable 1591 // Disable "CS1591 Missing XML comment for publicly visible type or member ..." +#pragma warning disable 8073 // Disable "CS8073 The result of the expression is always 'false' since a value of type 'T' is never equal to 'null' of type 'T?'" +#pragma warning disable 3016 // Disable "CS3016 Arrays as attribute arguments is not CLS-compliant" + +namespace Apimundo.Client +{ + using System = global::System; + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.14.5.0 (NJsonSchema v10.5.2.0 (Newtonsoft.Json v12.0.0.0))")] + public partial class WeatherForecastClient + { + private System.Net.Http.HttpClient _httpClient; + private System.Lazy _settings; + + public WeatherForecastClient(System.Net.Http.HttpClient httpClient) + { + _httpClient = httpClient; + _settings = new System.Lazy(CreateSerializerSettings); + } + + private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() + { + var settings = new Newtonsoft.Json.JsonSerializerSettings(); + UpdateJsonSerializerSettings(settings); + return settings; + } + + protected Newtonsoft.Json.JsonSerializerSettings JsonSerializerSettings { get { return _settings.Value; } } + + partial void UpdateJsonSerializerSettings(Newtonsoft.Json.JsonSerializerSettings settings); + + + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); + partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); + /// A server side error occurred. + public System.Threading.Tasks.Task> GetAsync() + { + return GetAsync(System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public async System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append("WeatherForecast"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + protected struct ObjectResponseResult + { + public ObjectResponseResult(T responseObject, string responseText) + { + this.Object = responseObject; + this.Text = responseText; + } + + public T Object { get; } + + public string Text { get; } + } + + public bool ReadResponseAsString { get; set; } + + protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) + { + if (response == null || response.Content == null) + { + return new ObjectResponseResult(default(T), string.Empty); + } + + if (ReadResponseAsString) + { + var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + var typedBody = Newtonsoft.Json.JsonConvert.DeserializeObject(responseText, JsonSerializerSettings); + return new ObjectResponseResult(typedBody, responseText); + } + catch (Newtonsoft.Json.JsonException exception) + { + var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); + } + } + else + { + try + { + using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) + using (var streamReader = new System.IO.StreamReader(responseStream)) + using (var jsonTextReader = new Newtonsoft.Json.JsonTextReader(streamReader)) + { + var serializer = Newtonsoft.Json.JsonSerializer.Create(JsonSerializerSettings); + var typedBody = serializer.Deserialize(jsonTextReader); + return new ObjectResponseResult(typedBody, string.Empty); + } + } + catch (Newtonsoft.Json.JsonException exception) + { + var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); + } + } + } + + private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) + { + if (value == null) + { + return ""; + } + + if (value is System.Enum) + { + var name = System.Enum.GetName(value.GetType(), value); + if (name != null) + { + var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); + if (field != null) + { + var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) + as System.Runtime.Serialization.EnumMemberAttribute; + if (attribute != null) + { + return attribute.Value != null ? attribute.Value : name; + } + } + + var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); + return converted == null ? string.Empty : converted; + } + } + else if (value is bool) + { + return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); + } + else if (value is byte[]) + { + return System.Convert.ToBase64String((byte[]) value); + } + else if (value.GetType().IsArray) + { + var array = System.Linq.Enumerable.OfType((System.Array) value); + return string.Join(",", System.Linq.Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); + } + + var result = System.Convert.ToString(value, cultureInfo); + return result == null ? "" : result; + } + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.5.2.0 (Newtonsoft.Json v12.0.0.0)")] + public partial class WeatherForecast : System.ComponentModel.INotifyPropertyChanged + { + private System.DateTime _date; + private int _temperatureC; + private int _temperatureF; + private string _summary; + + [Newtonsoft.Json.JsonProperty("date", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.DateTime Date + { + get { return _date; } + set + { + if (_date != value) + { + _date = value; + RaisePropertyChanged(); + } + } + } + + [Newtonsoft.Json.JsonProperty("temperatureC", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int TemperatureC + { + get { return _temperatureC; } + set + { + if (_temperatureC != value) + { + _temperatureC = value; + RaisePropertyChanged(); + } + } + } + + [Newtonsoft.Json.JsonProperty("temperatureF", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int TemperatureF + { + get { return _temperatureF; } + set + { + if (_temperatureF != value) + { + _temperatureF = value; + RaisePropertyChanged(); + } + } + } + + [Newtonsoft.Json.JsonProperty("summary", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Summary + { + get { return _summary; } + set + { + if (_summary != value) + { + _summary = value; + RaisePropertyChanged(); + } + } + } + + public string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, new Newtonsoft.Json.JsonSerializerSettings()); + } + + public static WeatherForecast FromJson(string data) + { + return Newtonsoft.Json.JsonConvert.DeserializeObject(data, new Newtonsoft.Json.JsonSerializerSettings()); + } + + public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; + + protected virtual void RaisePropertyChanged([System.Runtime.CompilerServices.CallerMemberName] string propertyName = null) + { + var handler = PropertyChanged; + if (handler != null) + handler(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.14.5.0 (NJsonSchema v10.5.2.0 (Newtonsoft.Json v12.0.0.0))")] + public partial class ApiException : System.Exception + { + public int StatusCode { get; private set; } + + public string Response { get; private set; } + + public System.Collections.Generic.IReadOnlyDictionary> Headers { get; private set; } + + public ApiException(string message, int statusCode, string response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Exception innerException) + : base(message + "\n\nStatus: " + statusCode + "\nResponse: \n" + ((response == null) ? "(null)" : response.Substring(0, response.Length >= 512 ? 512 : response.Length)), innerException) + { + StatusCode = statusCode; + Response = response; + Headers = headers; + } + + public override string ToString() + { + return string.Format("HTTP Response: \n\n{0}\n\n{1}", Response, base.ToString()); + } + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.14.5.0 (NJsonSchema v10.5.2.0 (Newtonsoft.Json v12.0.0.0))")] + public partial class ApiException : ApiException + { + public TResult Result { get; private set; } + + public ApiException(string message, int statusCode, string response, System.Collections.Generic.IReadOnlyDictionary> headers, TResult result, System.Exception innerException) + : base(message, statusCode, response, headers, innerException) + { + Result = result; + } + } + +} + +#pragma warning restore 1591 +#pragma warning restore 1573 +#pragma warning restore 472 +#pragma warning restore 114 +#pragma warning restore 108 +#pragma warning restore 3016 \ No newline at end of file diff --git a/samples/WithMiddleware/Sample.AspNetCore31.Client/Sample.AspNetCore31.Client.csproj b/samples/WithMiddleware/Sample.AspNetCore60.Client/Sample.AspNetCore60.Client.csproj similarity index 86% rename from samples/WithMiddleware/Sample.AspNetCore31.Client/Sample.AspNetCore31.Client.csproj rename to samples/WithMiddleware/Sample.AspNetCore60.Client/Sample.AspNetCore60.Client.csproj index bf64fad359..71ada0e790 100644 --- a/samples/WithMiddleware/Sample.AspNetCore31.Client/Sample.AspNetCore31.Client.csproj +++ b/samples/WithMiddleware/Sample.AspNetCore60.Client/Sample.AspNetCore60.Client.csproj @@ -1,6 +1,7 @@ netstandard2.0 + Sample.AspNetCore31.Client diff --git a/samples/WithMiddleware/Sample.AspNetCore31/Controllers/WeatherForecastController.cs b/samples/WithMiddleware/Sample.AspNetCore60/Controllers/WeatherForecastController.cs similarity index 100% rename from samples/WithMiddleware/Sample.AspNetCore31/Controllers/WeatherForecastController.cs rename to samples/WithMiddleware/Sample.AspNetCore60/Controllers/WeatherForecastController.cs diff --git a/samples/WithMiddleware/Sample.AspNetCore31/Program.cs b/samples/WithMiddleware/Sample.AspNetCore60/Program.cs similarity index 100% rename from samples/WithMiddleware/Sample.AspNetCore31/Program.cs rename to samples/WithMiddleware/Sample.AspNetCore60/Program.cs diff --git a/samples/WithMiddleware/Sample.AspNetCore31/Properties/launchSettings.json b/samples/WithMiddleware/Sample.AspNetCore60/Properties/launchSettings.json similarity index 96% rename from samples/WithMiddleware/Sample.AspNetCore31/Properties/launchSettings.json rename to samples/WithMiddleware/Sample.AspNetCore60/Properties/launchSettings.json index a0b847d1eb..d20146bc49 100644 --- a/samples/WithMiddleware/Sample.AspNetCore31/Properties/launchSettings.json +++ b/samples/WithMiddleware/Sample.AspNetCore60/Properties/launchSettings.json @@ -17,7 +17,7 @@ "ASPNETCORE_ENVIRONMENT": "Development" } }, - "Sample.AspNetCore31": { + "Sample.AspNetCore60": { "commandName": "Project", "launchBrowser": true, "launchUrl": "swagger", diff --git a/samples/WithMiddleware/Sample.AspNetCore31/README.md b/samples/WithMiddleware/Sample.AspNetCore60/README.md similarity index 53% rename from samples/WithMiddleware/Sample.AspNetCore31/README.md rename to samples/WithMiddleware/Sample.AspNetCore60/README.md index 279042761a..8877fe0695 100644 --- a/samples/WithMiddleware/Sample.AspNetCore31/README.md +++ b/samples/WithMiddleware/Sample.AspNetCore60/README.md @@ -2,8 +2,8 @@ - Expose swagger.json and Swagger UI 3 via HTTP (middleware) - See Startup.cs - - Packages in Sample.AspNetCore31.csproj -- Automatically generate a C# client library on build (Sample.AspNetCore31.Client) - - Add NSwag.MSBuild in Sample.AspNetCore31.csproj and + - Packages in Sample.AspNetCore60.csproj +- Automatically generate a C# client library on build (Sample.AspNetCore60.Client) + - Add NSwag.MSBuild in Sample.AspNetCore60.csproj and - Add a build task in the .csproj - - Output is in the Sample.AspNetCore31.Client library project \ No newline at end of file + - Output is in the Sample.AspNetCore60.Client library project \ No newline at end of file diff --git a/samples/WithMiddleware/Sample.AspNetCore31/Sample.AspNetCore31.csproj b/samples/WithMiddleware/Sample.AspNetCore60/Sample.AspNetCore60.csproj similarity index 63% rename from samples/WithMiddleware/Sample.AspNetCore31/Sample.AspNetCore31.csproj rename to samples/WithMiddleware/Sample.AspNetCore60/Sample.AspNetCore60.csproj index 9c4029d3e0..f092f6c927 100644 --- a/samples/WithMiddleware/Sample.AspNetCore31/Sample.AspNetCore31.csproj +++ b/samples/WithMiddleware/Sample.AspNetCore60/Sample.AspNetCore60.csproj @@ -1,10 +1,12 @@  - netcoreapp3.1 + net6.0 + Sample.AspNetCore31 + @@ -15,6 +17,6 @@ - + diff --git a/samples/WithMiddleware/Sample.AspNetCore31/Startup.cs b/samples/WithMiddleware/Sample.AspNetCore60/Startup.cs similarity index 100% rename from samples/WithMiddleware/Sample.AspNetCore31/Startup.cs rename to samples/WithMiddleware/Sample.AspNetCore60/Startup.cs diff --git a/samples/WithMiddleware/Sample.AspNetCore31/WeatherForecast.cs b/samples/WithMiddleware/Sample.AspNetCore60/WeatherForecast.cs similarity index 100% rename from samples/WithMiddleware/Sample.AspNetCore31/WeatherForecast.cs rename to samples/WithMiddleware/Sample.AspNetCore60/WeatherForecast.cs diff --git a/samples/WithMiddleware/Sample.AspNetCore31/appsettings.Development.json b/samples/WithMiddleware/Sample.AspNetCore60/appsettings.Development.json similarity index 100% rename from samples/WithMiddleware/Sample.AspNetCore31/appsettings.Development.json rename to samples/WithMiddleware/Sample.AspNetCore60/appsettings.Development.json diff --git a/samples/WithMiddleware/Sample.AspNetCore31/appsettings.json b/samples/WithMiddleware/Sample.AspNetCore60/appsettings.json similarity index 100% rename from samples/WithMiddleware/Sample.AspNetCore31/appsettings.json rename to samples/WithMiddleware/Sample.AspNetCore60/appsettings.json diff --git a/samples/WithMiddleware/Sample.AspNetCore31/nswag.json b/samples/WithMiddleware/Sample.AspNetCore60/nswag.json similarity index 97% rename from samples/WithMiddleware/Sample.AspNetCore31/nswag.json rename to samples/WithMiddleware/Sample.AspNetCore60/nswag.json index 0867fceae0..7836ff91b5 100644 --- a/samples/WithMiddleware/Sample.AspNetCore31/nswag.json +++ b/samples/WithMiddleware/Sample.AspNetCore60/nswag.json @@ -1,9 +1,9 @@ { - "runtime": "NetCore31", + "runtime": "Net60", "defaultVariables": "Configuration=Debug", "documentGenerator": { "aspNetCoreToOpenApi": { - "project": "Sample.AspNetCore31.csproj", + "project": "Sample.AspNetCore60.csproj", "msBuildProjectExtensionsPath": null, "configuration": "$(Configuration)", "runtime": null, @@ -132,7 +132,7 @@ "enumNameGeneratorType": null, "serviceHost": null, "serviceSchemes": null, - "output": "../Sample.AspNetCore31.Client/Clients.generated.cs" + "output": "../Sample.AspNetCore60.Client/Clients.generated.cs" } } } \ No newline at end of file diff --git a/samples/WithMiddleware/Sample.AspNetCore31/openapi.json b/samples/WithMiddleware/Sample.AspNetCore60/openapi.json similarity index 93% rename from samples/WithMiddleware/Sample.AspNetCore31/openapi.json rename to samples/WithMiddleware/Sample.AspNetCore60/openapi.json index f69c7ca45d..fe8039f791 100644 --- a/samples/WithMiddleware/Sample.AspNetCore31/openapi.json +++ b/samples/WithMiddleware/Sample.AspNetCore60/openapi.json @@ -1,5 +1,5 @@ { - "x-generator": "NSwag v13.8.2.0 (NJsonSchema v10.2.1.0 (Newtonsoft.Json v9.0.0.0))", + "x-generator": "NSwag v13.14.5.0 (NJsonSchema v10.5.2.0 (Newtonsoft.Json v9.0.0.0))", "openapi": "3.0.0", "info": { "title": "My Sample App", diff --git a/samples/WithMiddleware/Sample.NetOwinMiddleware/Sample.NetOwinMiddleware.csproj b/samples/WithMiddleware/Sample.NetOwinMiddleware/Sample.NetOwinMiddleware.csproj index e51e0b3bfb..f519c48924 100644 --- a/samples/WithMiddleware/Sample.NetOwinMiddleware/Sample.NetOwinMiddleware.csproj +++ b/samples/WithMiddleware/Sample.NetOwinMiddleware/Sample.NetOwinMiddleware.csproj @@ -1,5 +1,4 @@  - Debug @@ -44,46 +43,8 @@ - - ..\..\packages\Microsoft.Owin.4.0.1\lib\net45\Microsoft.Owin.dll - - - ..\..\packages\Microsoft.Owin.FileSystems.3.0.1\lib\net45\Microsoft.Owin.FileSystems.dll - - - ..\..\packages\Microsoft.Owin.Host.SystemWeb.4.0.1\lib\net45\Microsoft.Owin.Host.SystemWeb.dll - - - ..\..\packages\Microsoft.Owin.StaticFiles.3.0.1\lib\net45\Microsoft.Owin.StaticFiles.dll - - - ..\..\packages\Namotion.Reflection.2.0.3\lib\net45\Namotion.Reflection.dll - - - ..\..\packages\NJsonSchema.10.5.2\lib\net45\NJsonSchema.dll - - - ..\..\packages\NSwag.AspNet.Owin.13.14.5\lib\net45\NSwag.AspNet.Owin.dll - - - ..\..\packages\NSwag.Core.13.14.5\lib\net45\NSwag.Core.dll - - - ..\..\packages\NSwag.Generation.13.14.5\lib\net45\NSwag.Generation.dll - True - - - ..\..\packages\NSwag.Generation.WebApi.13.14.5\lib\net45\NSwag.Generation.WebApi.dll - True - - - ..\..\packages\Owin.1.0\lib\net40\Owin.dll - - - ..\..\packages\Microsoft.AspNet.WebApi.Client.5.2.7\lib\net45\System.Net.Http.Formatting.dll - @@ -94,12 +55,6 @@ - - ..\..\packages\Microsoft.AspNet.WebApi.Core.5.2.7\lib\net45\System.Web.Http.dll - - - ..\..\packages\Microsoft.AspNet.WebApi.Owin.5.2.7\lib\net45\System.Web.Http.Owin.dll - @@ -108,17 +63,6 @@ - - - ..\..\packages\Newtonsoft.Json.11.0.1\lib\net45\Newtonsoft.Json.dll - - - ..\..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.4\lib\net45\System.Web.Http.WebHost.dll - - - ..\..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.0\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll - - @@ -129,7 +73,6 @@ - Web.config @@ -141,6 +84,26 @@ + + + + + + + + + + + + + + + + + + + + 10.0 $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) @@ -166,12 +129,6 @@ - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - + + - @@ -46,22 +46,17 @@ - + + + + + - - - - - - - - - - - - + + - + + \ No newline at end of file diff --git a/samples/WithMiddleware/Sample.NetOwinMiddleware/packages.config b/samples/WithMiddleware/Sample.NetOwinMiddleware/packages.config deleted file mode 100644 index a90c8ef287..0000000000 --- a/samples/WithMiddleware/Sample.NetOwinMiddleware/packages.config +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/samples/WithoutMiddleware/Sample.AspNetCore21/appsettings.Development.json b/samples/WithoutMiddleware/Sample.AspNetCore21/appsettings.Development.json deleted file mode 100644 index e203e9407e..0000000000 --- a/samples/WithoutMiddleware/Sample.AspNetCore21/appsettings.Development.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Debug", - "System": "Information", - "Microsoft": "Information" - } - } -} diff --git a/samples/WithoutMiddleware/Sample.AspNetCore21/appsettings.json b/samples/WithoutMiddleware/Sample.AspNetCore21/appsettings.json deleted file mode 100644 index def9159a7d..0000000000 --- a/samples/WithoutMiddleware/Sample.AspNetCore21/appsettings.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Warning" - } - }, - "AllowedHosts": "*" -} diff --git a/samples/WithoutMiddleware/Sample.AspNetCore21/nswag_assembly_swagger.json b/samples/WithoutMiddleware/Sample.AspNetCore21/nswag_assembly_swagger.json deleted file mode 100644 index 4a2cb002c9..0000000000 --- a/samples/WithoutMiddleware/Sample.AspNetCore21/nswag_assembly_swagger.json +++ /dev/null @@ -1,152 +0,0 @@ -{ - "x-generator": "NSwag v13.15.5.0 (NJsonSchema v10.6.6.0 (Newtonsoft.Json v11.0.0.0))", - "swagger": "2.0", - "info": { - "title": "My Title", - "version": "1.0.0" - }, - "paths": { - "/api/Values": { - "get": { - "tags": [ - "Values" - ], - "operationId": "Values_GetAll", - "produces": [ - "text/plain", - "application/json", - "text/json" - ], - "responses": { - "200": { - "x-nullable": false, - "description": "", - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - } - } - }, - "post": { - "tags": [ - "Values" - ], - "operationId": "Values_Post", - "consumes": [ - "application/json-patch+json", - "application/json", - "text/json", - "application/*+json" - ], - "parameters": [ - { - "name": "value", - "in": "body", - "required": true, - "schema": { - "type": "string" - }, - "x-nullable": false - } - ], - "responses": { - "200": { - "description": "" - } - } - } - }, - "/api/Values/{id}": { - "get": { - "tags": [ - "Values" - ], - "operationId": "Values_Get", - "produces": [ - "text/plain", - "application/json", - "text/json" - ], - "parameters": [ - { - "type": "integer", - "name": "id", - "in": "path", - "required": true, - "format": "int32", - "x-nullable": false - } - ], - "responses": { - "200": { - "x-nullable": false, - "description": "", - "schema": { - "type": "string" - } - } - } - }, - "put": { - "tags": [ - "Values" - ], - "operationId": "Values_Put", - "consumes": [ - "application/json-patch+json", - "application/json", - "text/json", - "application/*+json" - ], - "parameters": [ - { - "type": "integer", - "name": "id", - "in": "path", - "required": true, - "format": "int32", - "x-nullable": false - }, - { - "name": "value", - "in": "body", - "required": true, - "schema": { - "type": "string" - }, - "x-nullable": false - } - ], - "responses": { - "200": { - "description": "" - } - } - }, - "delete": { - "tags": [ - "Values" - ], - "operationId": "Values_Delete", - "parameters": [ - { - "type": "integer", - "name": "id", - "in": "path", - "required": true, - "format": "int32", - "x-nullable": false - } - ], - "responses": { - "200": { - "description": "" - } - } - } - } - } -} \ No newline at end of file diff --git a/samples/WithoutMiddleware/Sample.AspNetCore21/Controllers/ValuesController.cs b/samples/WithoutMiddleware/Sample.AspNetCore60/Controllers/ValuesController.cs similarity index 100% rename from samples/WithoutMiddleware/Sample.AspNetCore21/Controllers/ValuesController.cs rename to samples/WithoutMiddleware/Sample.AspNetCore60/Controllers/ValuesController.cs diff --git a/samples/WithoutMiddleware/Sample.AspNetCore21/Program.cs b/samples/WithoutMiddleware/Sample.AspNetCore60/Program.cs similarity index 100% rename from samples/WithoutMiddleware/Sample.AspNetCore21/Program.cs rename to samples/WithoutMiddleware/Sample.AspNetCore60/Program.cs diff --git a/samples/WithoutMiddleware/Sample.AspNetCore21/Properties/launchSettings.json b/samples/WithoutMiddleware/Sample.AspNetCore60/Properties/launchSettings.json similarity index 100% rename from samples/WithoutMiddleware/Sample.AspNetCore21/Properties/launchSettings.json rename to samples/WithoutMiddleware/Sample.AspNetCore60/Properties/launchSettings.json diff --git a/samples/WithoutMiddleware/Sample.AspNetCore21/Sample.AspNetCore21.csproj b/samples/WithoutMiddleware/Sample.AspNetCore60/Sample.AspNetCore60.csproj similarity index 70% rename from samples/WithoutMiddleware/Sample.AspNetCore21/Sample.AspNetCore21.csproj rename to samples/WithoutMiddleware/Sample.AspNetCore60/Sample.AspNetCore60.csproj index 2767460a3e..d2a6455719 100644 --- a/samples/WithoutMiddleware/Sample.AspNetCore21/Sample.AspNetCore21.csproj +++ b/samples/WithoutMiddleware/Sample.AspNetCore60/Sample.AspNetCore60.csproj @@ -1,15 +1,15 @@ - netcoreapp2.1 + net6.0 - + - + diff --git a/samples/WithoutMiddleware/Sample.AspNetCore21/Startup.cs b/samples/WithoutMiddleware/Sample.AspNetCore60/Startup.cs similarity index 88% rename from samples/WithoutMiddleware/Sample.AspNetCore21/Startup.cs rename to samples/WithoutMiddleware/Sample.AspNetCore60/Startup.cs index 0020aacda3..21700409df 100644 --- a/samples/WithoutMiddleware/Sample.AspNetCore21/Startup.cs +++ b/samples/WithoutMiddleware/Sample.AspNetCore60/Startup.cs @@ -25,7 +25,9 @@ public Startup(IConfiguration configuration) // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); + services + .AddMvc(options => options.EnableEndpointRouting = false) + .SetCompatibilityVersion(CompatibilityVersion.Version_2_1); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. diff --git a/samples/WithMiddleware/Sample.AspNetCore21.Nginx/appsettings.Development.json b/samples/WithoutMiddleware/Sample.AspNetCore60/appsettings.Development.json similarity index 100% rename from samples/WithMiddleware/Sample.AspNetCore21.Nginx/appsettings.Development.json rename to samples/WithoutMiddleware/Sample.AspNetCore60/appsettings.Development.json diff --git a/samples/WithMiddleware/Sample.AspNetCore21.Nginx/appsettings.json b/samples/WithoutMiddleware/Sample.AspNetCore60/appsettings.json similarity index 100% rename from samples/WithMiddleware/Sample.AspNetCore21.Nginx/appsettings.json rename to samples/WithoutMiddleware/Sample.AspNetCore60/appsettings.json diff --git a/samples/WithoutMiddleware/Sample.AspNetCore21/nswag_assembly.nswag b/samples/WithoutMiddleware/Sample.AspNetCore60/nswag_assembly.nswag similarity index 96% rename from samples/WithoutMiddleware/Sample.AspNetCore21/nswag_assembly.nswag rename to samples/WithoutMiddleware/Sample.AspNetCore60/nswag_assembly.nswag index 0ffecb6bab..7063dae218 100644 --- a/samples/WithoutMiddleware/Sample.AspNetCore21/nswag_assembly.nswag +++ b/samples/WithoutMiddleware/Sample.AspNetCore60/nswag_assembly.nswag @@ -48,7 +48,7 @@ "output": "nswag_assembly_swagger.json", "outputType": "Swagger2", "assemblyPaths": [ - "bin/$(configuration)/netcoreapp2.1/Sample.AspNetCore21.dll" + "bin/$(configuration)/net6.0/Sample.AspNetCore60.dll" ], "assemblyConfig": null, "referencePaths": [], diff --git a/samples/WithoutMiddleware/Sample.AspNetCore21/nswag_project.nswag b/samples/WithoutMiddleware/Sample.AspNetCore60/nswag_project.nswag similarity index 96% rename from samples/WithoutMiddleware/Sample.AspNetCore21/nswag_project.nswag rename to samples/WithoutMiddleware/Sample.AspNetCore60/nswag_project.nswag index 99f950fe0b..a364b8293c 100644 --- a/samples/WithoutMiddleware/Sample.AspNetCore21/nswag_project.nswag +++ b/samples/WithoutMiddleware/Sample.AspNetCore60/nswag_project.nswag @@ -1,9 +1,9 @@ { - "runtime": "NetCore21", + "runtime": "Net60", "defaultVariables": "configuration=Debug", "documentGenerator": { "aspNetCoreToOpenApi": { - "project": "Sample.AspNetCore21.csproj", + "project": "Sample.AspNetCore60.csproj", "msBuildProjectExtensionsPath": null, "configuration": "$(configuration)", "runtime": null, diff --git a/samples/WithoutMiddleware/Sample.AspNetCore21/nswag_project_swagger.json b/samples/WithoutMiddleware/Sample.AspNetCore60/nswag_project_swagger.json similarity index 100% rename from samples/WithoutMiddleware/Sample.AspNetCore21/nswag_project_swagger.json rename to samples/WithoutMiddleware/Sample.AspNetCore60/nswag_project_swagger.json diff --git a/samples/WithoutMiddleware/Sample.AspNetCore21/nswag_reflection.nswag b/samples/WithoutMiddleware/Sample.AspNetCore60/nswag_reflection.nswag similarity index 96% rename from samples/WithoutMiddleware/Sample.AspNetCore21/nswag_reflection.nswag rename to samples/WithoutMiddleware/Sample.AspNetCore60/nswag_reflection.nswag index 1f39a63f70..0a73288179 100644 --- a/samples/WithoutMiddleware/Sample.AspNetCore21/nswag_reflection.nswag +++ b/samples/WithoutMiddleware/Sample.AspNetCore60/nswag_reflection.nswag @@ -44,7 +44,7 @@ "output": "nswag_reflection_swagger.json", "outputType": "Swagger2", "assemblyPaths": [ - "bin/$(configuration)/netcoreapp2.1/Sample.AspNetCore21.dll" + "bin/$(configuration)/net6.0/Sample.AspNetCore60.dll" ], "assemblyConfig": null, "referencePaths": [], diff --git a/samples/WithoutMiddleware/Sample.AspNetCore21/nswag_reflection_swagger.json b/samples/WithoutMiddleware/Sample.AspNetCore60/nswag_reflection_swagger.json similarity index 100% rename from samples/WithoutMiddleware/Sample.AspNetCore21/nswag_reflection_swagger.json rename to samples/WithoutMiddleware/Sample.AspNetCore60/nswag_reflection_swagger.json diff --git a/src/NSwag.Annotations/NSwag.Annotations.csproj b/src/NSwag.Annotations/NSwag.Annotations.csproj index 460c52189d..3e74edcaca 100644 --- a/src/NSwag.Annotations/NSwag.Annotations.csproj +++ b/src/NSwag.Annotations/NSwag.Annotations.csproj @@ -1,11 +1,8 @@  - netstandard1.0;net45;netstandard2.0 + net462;netstandard2.0 bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml - - - \ No newline at end of file diff --git a/src/NSwag.ApiDescription.Client/NSwag.ApiDescription.Client.targets b/src/NSwag.ApiDescription.Client/NSwag.ApiDescription.Client.targets index e95c616469..1e4bb9fd77 100644 --- a/src/NSwag.ApiDescription.Client/NSwag.ApiDescription.Client.targets +++ b/src/NSwag.ApiDescription.Client/NSwag.ApiDescription.Client.targets @@ -4,8 +4,6 @@ <_NSwagCommand>$(NSwagExe) <_NSwagCommand Condition="'$(MSBuildRuntimeType)' == 'Core'">dotnet --roll-forward-on-no-candidate-fx 2 "$(NSwagDir_Core31)/dotnet-nswag.dll" - <_NSwagCommand - Condition="'$(TargetFramework)' == 'net5.0'">dotnet --roll-forward-on-no-candidate-fx 2 "$(NSwagDir_Net50)/dotnet-nswag.dll" <_NSwagCommand Condition="'$(TargetFramework)' == 'net6.0'">dotnet --roll-forward-on-no-candidate-fx 2 "$(NSwagDir_Net60)/dotnet-nswag.dll" <_NSwagCommand diff --git a/src/NSwag.AspNet.Owin/NSwag.AspNet.Owin.csproj b/src/NSwag.AspNet.Owin/NSwag.AspNet.Owin.csproj index 01b044f785..8ad2acd10c 100644 --- a/src/NSwag.AspNet.Owin/NSwag.AspNet.Owin.csproj +++ b/src/NSwag.AspNet.Owin/NSwag.AspNet.Owin.csproj @@ -1,9 +1,8 @@  - net45 - - + net462 bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml + $(DefineConstants);AspNetOwin @@ -17,12 +16,6 @@ - - TRACE;DEBUG;AspNetOwin;NET45 - - - TRACE;RELEASE;AspNetOwin;NET45 - diff --git a/src/NSwag.AspNet.WebApi/NSwag.AspNet.WebApi.csproj b/src/NSwag.AspNet.WebApi/NSwag.AspNet.WebApi.csproj index c960c5dd2f..92dc623470 100644 --- a/src/NSwag.AspNet.WebApi/NSwag.AspNet.WebApi.csproj +++ b/src/NSwag.AspNet.WebApi/NSwag.AspNet.WebApi.csproj @@ -1,13 +1,10 @@  - net45 + net462 bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml - - TRACE;DEBUG;NET45 - diff --git a/src/NSwag.AspNetCore.Launcher.x86/NSwag.AspNetCore.Launcher.x86.csproj b/src/NSwag.AspNetCore.Launcher.x86/NSwag.AspNetCore.Launcher.x86.csproj index bfe33ec8e8..2909459193 100644 --- a/src/NSwag.AspNetCore.Launcher.x86/NSwag.AspNetCore.Launcher.x86.csproj +++ b/src/NSwag.AspNetCore.Launcher.x86/NSwag.AspNetCore.Launcher.x86.csproj @@ -1,6 +1,6 @@  - net461 + net462 x86 Exe false diff --git a/src/NSwag.AspNetCore.Launcher/NSwag.AspNetCore.Launcher.csproj b/src/NSwag.AspNetCore.Launcher/NSwag.AspNetCore.Launcher.csproj index b744ad5f09..e0cf5ce4e2 100644 --- a/src/NSwag.AspNetCore.Launcher/NSwag.AspNetCore.Launcher.csproj +++ b/src/NSwag.AspNetCore.Launcher/NSwag.AspNetCore.Launcher.csproj @@ -1,12 +1,12 @@  - netcoreapp3.1;net461 - x64 + net6.0;net462 + x64 Exe false - + \ No newline at end of file diff --git a/src/NSwag.AspNetCore/NSwag.AspNetCore.csproj b/src/NSwag.AspNetCore/NSwag.AspNetCore.csproj index e807a52221..8c2cd6db8a 100644 --- a/src/NSwag.AspNetCore/NSwag.AspNetCore.csproj +++ b/src/NSwag.AspNetCore/NSwag.AspNetCore.csproj @@ -1,6 +1,6 @@  - net461;netstandard1.6;netstandard2.0;netcoreapp3.1;net5.0;net6.0;net7.0 + net462;netstandard2.0;net6.0;net7.0 Swagger Documentation AspNetCore NetCore TypeScript CodeGen $(MSBuildProjectName).nuspec symbols.nupkg @@ -30,7 +30,7 @@ - + @@ -40,17 +40,9 @@ - + - - - - - - - - diff --git a/src/NSwag.AspNetCore/NSwag.AspNetCore.nuspec b/src/NSwag.AspNetCore/NSwag.AspNetCore.nuspec index 349060e3ab..9a6d32a5df 100644 --- a/src/NSwag.AspNetCore/NSwag.AspNetCore.nuspec +++ b/src/NSwag.AspNetCore/NSwag.AspNetCore.nuspec @@ -11,7 +11,7 @@ NuGetIcon.png - + @@ -23,21 +23,6 @@ - - - - - - - - - - - - - - - @@ -52,24 +37,6 @@ - - - - - - - - - - - - - - - - - - @@ -94,16 +61,10 @@ - - - - + + - - - - diff --git a/src/NSwag.AssemblyLoader.Tests/NSwag.AssemblyLoader.Tests.csproj b/src/NSwag.AssemblyLoader.Tests/NSwag.AssemblyLoader.Tests.csproj index a9bed4490e..fc9b9e79d8 100644 --- a/src/NSwag.AssemblyLoader.Tests/NSwag.AssemblyLoader.Tests.csproj +++ b/src/NSwag.AssemblyLoader.Tests/NSwag.AssemblyLoader.Tests.csproj @@ -1,6 +1,6 @@  - netcoreapp2.1;net461 + net6.0;net462 false diff --git a/src/NSwag.AssemblyLoader/NSwag.AssemblyLoader.csproj b/src/NSwag.AssemblyLoader/NSwag.AssemblyLoader.csproj index 02d14aa8c4..b3b7effd59 100644 --- a/src/NSwag.AssemblyLoader/NSwag.AssemblyLoader.csproj +++ b/src/NSwag.AssemblyLoader/NSwag.AssemblyLoader.csproj @@ -1,6 +1,6 @@  - netstandard1.6;net461;netstandard2.0 + net462;netstandard2.0 $(NoWarn),1591 bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml @@ -11,7 +11,7 @@ - + diff --git a/src/NSwag.CodeGeneration.CSharp.Tests/NSwag.CodeGeneration.CSharp.Tests.csproj b/src/NSwag.CodeGeneration.CSharp.Tests/NSwag.CodeGeneration.CSharp.Tests.csproj index 720d329731..e681e11d90 100644 --- a/src/NSwag.CodeGeneration.CSharp.Tests/NSwag.CodeGeneration.CSharp.Tests.csproj +++ b/src/NSwag.CodeGeneration.CSharp.Tests/NSwag.CodeGeneration.CSharp.Tests.csproj @@ -1,10 +1,9 @@ - + - netcoreapp2.1 + net6.0 - diff --git a/src/NSwag.CodeGeneration.CSharp.Tests/Properties/launchSettings.json b/src/NSwag.CodeGeneration.CSharp.Tests/Properties/launchSettings.json new file mode 100644 index 0000000000..624f2e1321 --- /dev/null +++ b/src/NSwag.CodeGeneration.CSharp.Tests/Properties/launchSettings.json @@ -0,0 +1,12 @@ +{ + "profiles": { + "NSwag.CodeGeneration.CSharp.Tests": { + "commandName": "Project", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "applicationUrl": "https://localhost:62292;http://localhost:62297" + } + } +} \ No newline at end of file diff --git a/src/NSwag.CodeGeneration.CSharp/NSwag.CodeGeneration.CSharp.csproj b/src/NSwag.CodeGeneration.CSharp/NSwag.CodeGeneration.CSharp.csproj index 2eb63f8d5c..330ac0aaae 100644 --- a/src/NSwag.CodeGeneration.CSharp/NSwag.CodeGeneration.CSharp.csproj +++ b/src/NSwag.CodeGeneration.CSharp/NSwag.CodeGeneration.CSharp.csproj @@ -1,6 +1,6 @@  - net461;netstandard2.0 + net462;netstandard2.0 bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml @@ -8,7 +8,7 @@ - + diff --git a/src/NSwag.CodeGeneration.Tests/NSwag.CodeGeneration.Tests.csproj b/src/NSwag.CodeGeneration.Tests/NSwag.CodeGeneration.Tests.csproj index 878732e56f..d358918b4e 100644 --- a/src/NSwag.CodeGeneration.Tests/NSwag.CodeGeneration.Tests.csproj +++ b/src/NSwag.CodeGeneration.Tests/NSwag.CodeGeneration.Tests.csproj @@ -1,10 +1,9 @@  - netcoreapp2.1 + net6.0 - diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/NSwag.CodeGeneration.TypeScript.Tests.csproj b/src/NSwag.CodeGeneration.TypeScript.Tests/NSwag.CodeGeneration.TypeScript.Tests.csproj index fbf62de773..abaf122053 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/NSwag.CodeGeneration.TypeScript.Tests.csproj +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/NSwag.CodeGeneration.TypeScript.Tests.csproj @@ -1,10 +1,9 @@ - + - netcoreapp2.1 + net6.0 - diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Properties/launchSettings.json b/src/NSwag.CodeGeneration.TypeScript.Tests/Properties/launchSettings.json new file mode 100644 index 0000000000..3b4df2e877 --- /dev/null +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Properties/launchSettings.json @@ -0,0 +1,12 @@ +{ + "profiles": { + "NSwag.CodeGeneration.TypeScript.Tests": { + "commandName": "Project", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "applicationUrl": "https://localhost:62291;http://localhost:62295" + } + } +} \ No newline at end of file diff --git a/src/NSwag.CodeGeneration.TypeScript/NSwag.CodeGeneration.TypeScript.csproj b/src/NSwag.CodeGeneration.TypeScript/NSwag.CodeGeneration.TypeScript.csproj index fe4e6e8cbd..c47f505a97 100644 --- a/src/NSwag.CodeGeneration.TypeScript/NSwag.CodeGeneration.TypeScript.csproj +++ b/src/NSwag.CodeGeneration.TypeScript/NSwag.CodeGeneration.TypeScript.csproj @@ -1,6 +1,6 @@  - net461;netstandard2.0 + net462;netstandard2.0 bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml @@ -8,7 +8,7 @@ - + diff --git a/src/NSwag.CodeGeneration/NSwag.CodeGeneration.csproj b/src/NSwag.CodeGeneration/NSwag.CodeGeneration.csproj index 462456ea36..c48390fdbb 100644 --- a/src/NSwag.CodeGeneration/NSwag.CodeGeneration.csproj +++ b/src/NSwag.CodeGeneration/NSwag.CodeGeneration.csproj @@ -1,6 +1,6 @@  - net461;netstandard2.0 + net462;netstandard2.0 bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml @@ -10,7 +10,7 @@ - + diff --git a/src/NSwag.Commands/Commands/Generation/AspNetCore/AspNetCoreToOpenApiCommand.cs b/src/NSwag.Commands/Commands/Generation/AspNetCore/AspNetCoreToOpenApiCommand.cs index 9002332e57..2656f44166 100644 --- a/src/NSwag.Commands/Commands/Generation/AspNetCore/AspNetCoreToOpenApiCommand.cs +++ b/src/NSwag.Commands/Commands/Generation/AspNetCore/AspNetCoreToOpenApiCommand.cs @@ -124,7 +124,7 @@ public override async Task RunAsync(CommandLineProcessor processor, ICon var args = new List(); string executable; -#if NET461 +#if NET462 var toolDirectory = AppDomain.CurrentDomain.BaseDirectory; if (!Directory.Exists(toolDirectory)) { diff --git a/src/NSwag.Commands/Commands/IsolatedCommandBase.cs b/src/NSwag.Commands/Commands/IsolatedCommandBase.cs index bb4f1d661a..4732d3967b 100644 --- a/src/NSwag.Commands/Commands/IsolatedCommandBase.cs +++ b/src/NSwag.Commands/Commands/IsolatedCommandBase.cs @@ -99,7 +99,7 @@ private static string[] LoadDefaultNugetCache() return new[] { Path.GetFullPath(path) }; } -#if NET461 +#if NET462 public IEnumerable GetAssemblies(string assemblyDirectory) { var codeBaseDirectory = Path.GetDirectoryName(new Uri(typeof(IsolatedCommandBase<>).GetTypeInfo().Assembly.CodeBase).LocalPath); @@ -129,7 +129,7 @@ public IEnumerable GetAssemblies(string assemblyDirectory) public IEnumerable GetBindingRedirects() { -#if NET461 +#if NET462 yield return new BindingRedirect("Newtonsoft.Json", typeof(JToken), "30ad4fe6b2a6aeed"); yield return new BindingRedirect("Namotion.Reflection", typeof(ContextualType), "c2f9c3bdfae56102"); yield return new BindingRedirect("NJsonSchema", typeof(JsonSchema), "c2f9c3bdfae56102"); diff --git a/src/NSwag.Commands/HostApplication.cs b/src/NSwag.Commands/HostApplication.cs index 343680b4ac..840b2dca8b 100644 --- a/src/NSwag.Commands/HostApplication.cs +++ b/src/NSwag.Commands/HostApplication.cs @@ -92,7 +92,7 @@ public static IServiceProvider GetServiceProvider(Assembly assembly) internal static IServiceProvider GetServiceProviderWithHostFactoryResolver(Assembly assembly) { -#if NETCOREAPP2_1 || NETFRAMEWORK +#if NETFRAMEWORK return null; #else // We're disabling the default server and the console host lifetime. This will disable: diff --git a/src/NSwag.Commands/NSwag.Commands.csproj b/src/NSwag.Commands/NSwag.Commands.csproj index 3961cc38d7..e8e9a67bb9 100644 --- a/src/NSwag.Commands/NSwag.Commands.csproj +++ b/src/NSwag.Commands/NSwag.Commands.csproj @@ -1,7 +1,7 @@  - net461;netcoreapp2.1;netcoreapp3.1;net5.0;net6.0;net7.0 + net462;net6.0;net7.0 bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml $(NoWarn),618,1591 @@ -11,28 +11,6 @@ - - - - - - - - - - - - - - - - - - - - - - @@ -47,7 +25,7 @@ - + @@ -60,7 +38,7 @@ - + diff --git a/src/NSwag.Commands/NSwagDocument.cs b/src/NSwag.Commands/NSwagDocument.cs index 898401894b..3fa4ccdcac 100644 --- a/src/NSwag.Commands/NSwagDocument.cs +++ b/src/NSwag.Commands/NSwagDocument.cs @@ -25,7 +25,7 @@ namespace NSwag.Commands /// public class NSwagDocument : NSwagDocumentBase { -#if NET461 +#if NET462 /// Gets or sets the root binary directory where the command line executables loaded from. public static string RootBinaryDirectory { get; set; } = @@ -305,22 +305,9 @@ private string GetDocumentDirectory() private string GetArgumentsPrefix() { -#if NET461 - +#if NET462 var runtime = Runtime != Runtime.Default ? Runtime : RuntimeUtilities.CurrentRuntime; - if (runtime == Runtime.NetCore21) - { - return "\"" + System.IO.Path.Combine(RootBinaryDirectory, "NetCore21/dotnet-nswag.dll") + "\" "; - } - else if (runtime == Runtime.NetCore31) - { - return "\"" + System.IO.Path.Combine(RootBinaryDirectory, "NetCore31/dotnet-nswag.dll") + "\" "; - } - else if (runtime == Runtime.Net50) - { - return "\"" + System.IO.Path.Combine(RootBinaryDirectory, "Net50/dotnet-nswag.dll") + "\" "; - } - else if (runtime == Runtime.Net60) + if (runtime == Runtime.Net60) { return "\"" + System.IO.Path.Combine(RootBinaryDirectory, "Net60/dotnet-nswag.dll") + "\" "; } @@ -335,7 +322,7 @@ private string GetArgumentsPrefix() private string GetProgramName() { -#if NET461 +#if NET462 var runtime = Runtime != Runtime.Default ? Runtime : RuntimeUtilities.CurrentRuntime; if (runtime == Runtime.WinX64 || runtime == Runtime.Debug) diff --git a/src/NSwag.Commands/NSwagDocumentBase.cs b/src/NSwag.Commands/NSwagDocumentBase.cs index 4948d3e25b..6d3b9ec27d 100644 --- a/src/NSwag.Commands/NSwagDocumentBase.cs +++ b/src/NSwag.Commands/NSwagDocumentBase.cs @@ -57,7 +57,7 @@ protected NSwagDocumentBase() public abstract Task ExecuteAsync(); /// Gets or sets the runtime where the document should be processed. - public Runtime Runtime { get; set; } = Runtime.NetCore21; + public Runtime Runtime { get; set; } = Runtime.Net60; /// Gets or sets the default variables. public string DefaultVariables { get; set; } diff --git a/src/NSwag.Commands/Runtime.cs b/src/NSwag.Commands/Runtime.cs index d05b3ca628..63b5569335 100644 --- a/src/NSwag.Commands/Runtime.cs +++ b/src/NSwag.Commands/Runtime.cs @@ -20,15 +20,6 @@ public enum Runtime /// Full .NET framework, x86. WinX86, - /// .NET Core 2.1 app. - NetCore21, - - /// .NET Core 3.1 app. - NetCore31, - - /// .NET 5 app. - Net50, - /// .NET 6 app. Net60, diff --git a/src/NSwag.Commands/RuntimeUtilities.cs b/src/NSwag.Commands/RuntimeUtilities.cs index cb9958b386..71370da34d 100644 --- a/src/NSwag.Commands/RuntimeUtilities.cs +++ b/src/NSwag.Commands/RuntimeUtilities.cs @@ -25,28 +25,17 @@ public static Runtime CurrentRuntime var framework = PlatformServices.Default.Application.RuntimeFramework; if (framework.Identifier == ".NETCoreApp") { - if (framework.Version.Major == 2) - { - return Runtime.NetCore21; - } - else if (framework.Version.Major >= 7) + if (framework.Version.Major >= 7) { return Runtime.Net70; } - else if (framework.Version.Major >= 6) + + if (framework.Version.Major >= 6) { return Runtime.Net60; } - else if (framework.Version.Major >= 5) - { - return Runtime.Net50; - } - else if (framework.Version.Major >= 3) - { - return Runtime.NetCore31; - } - return Runtime.NetCore21; + return Runtime.Net60; } return IntPtr.Size == 4 ? Runtime.WinX86 : Runtime.WinX64; #endif diff --git a/src/NSwag.Console.x86/NSwag.Console.x86.csproj b/src/NSwag.Console.x86/NSwag.Console.x86.csproj index 50a0134a70..23e297ae00 100644 --- a/src/NSwag.Console.x86/NSwag.Console.x86.csproj +++ b/src/NSwag.Console.x86/NSwag.Console.x86.csproj @@ -1,6 +1,6 @@  - net461 + net462 Exe exe @@ -10,9 +10,6 @@ x86 true - - TRACE;DEBUG;net46 - diff --git a/src/NSwag.Console/NSwag.Console.csproj b/src/NSwag.Console/NSwag.Console.csproj index e0e14afc5a..47472f2825 100644 --- a/src/NSwag.Console/NSwag.Console.csproj +++ b/src/NSwag.Console/NSwag.Console.csproj @@ -1,6 +1,6 @@  - net461 + net462 Exe exe @@ -9,15 +9,6 @@ NSwag true - - TRACE;DEBUG;net46 - - - bin\$(Configuration)\ - - - bin\$(Configuration)\ - diff --git a/src/NSwag.ConsoleCore/NSwag.ConsoleCore.csproj b/src/NSwag.ConsoleCore/NSwag.ConsoleCore.csproj index 2899db20f1..6a0571e537 100644 --- a/src/NSwag.ConsoleCore/NSwag.ConsoleCore.csproj +++ b/src/NSwag.ConsoleCore/NSwag.ConsoleCore.csproj @@ -1,6 +1,6 @@  - netcoreapp2.1;netcoreapp3.1;net5.0;net6.0;net7.0 + net6.0;net7.0 Exe dotnet-nswag NSwag.ConsoleCore @@ -13,23 +13,6 @@ - - - - - - - - - - - - - - - - - diff --git a/src/NSwag.Core.Tests/NSwag.Core.Tests.csproj b/src/NSwag.Core.Tests/NSwag.Core.Tests.csproj index b9a45c53e3..879fd8cbf1 100644 --- a/src/NSwag.Core.Tests/NSwag.Core.Tests.csproj +++ b/src/NSwag.Core.Tests/NSwag.Core.Tests.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1 + net6.0 false $(NoWarn),618 diff --git a/src/NSwag.Core.Yaml.Tests/NSwag.Core.Yaml.Tests.csproj b/src/NSwag.Core.Yaml.Tests/NSwag.Core.Yaml.Tests.csproj index bb926d4a07..3a70a81022 100644 --- a/src/NSwag.Core.Yaml.Tests/NSwag.Core.Yaml.Tests.csproj +++ b/src/NSwag.Core.Yaml.Tests/NSwag.Core.Yaml.Tests.csproj @@ -1,6 +1,6 @@  - netcoreapp3.1 + net6.0 false diff --git a/src/NSwag.Core.Yaml/NSwag.Core.Yaml.csproj b/src/NSwag.Core.Yaml/NSwag.Core.Yaml.csproj index 33918e422d..f5a54de654 100644 --- a/src/NSwag.Core.Yaml/NSwag.Core.Yaml.csproj +++ b/src/NSwag.Core.Yaml/NSwag.Core.Yaml.csproj @@ -1,6 +1,6 @@  - netstandard1.3;net45;netstandard2.0 + net462;netstandard2.0 NSwag diff --git a/src/NSwag.Core/NSwag.Core.csproj b/src/NSwag.Core/NSwag.Core.csproj index 5747f66bf8..d15b663803 100644 --- a/src/NSwag.Core/NSwag.Core.csproj +++ b/src/NSwag.Core/NSwag.Core.csproj @@ -1,6 +1,6 @@  - netstandard1.0;net45;netstandard2.0 + net462;netstandard2.0 NSwag @@ -10,12 +10,4 @@ - - - - - - - - \ No newline at end of file diff --git a/src/NSwag.Demo.Web/NSwag.Demo.Web.csproj b/src/NSwag.Demo.Web/NSwag.Demo.Web.csproj index 456023a06d..e56f5c8e3c 100644 --- a/src/NSwag.Demo.Web/NSwag.Demo.Web.csproj +++ b/src/NSwag.Demo.Web/NSwag.Demo.Web.csproj @@ -14,7 +14,7 @@ Properties NSwag.Demo.Web NSwag.Demo.Web - v4.6.1 + v4.6.2 win true diff --git a/src/NSwag.Generation.AspNetCore.Tests.Web/NSwag.Generation.AspNetCore.Tests.Web.csproj b/src/NSwag.Generation.AspNetCore.Tests.Web/NSwag.Generation.AspNetCore.Tests.Web.csproj index 68b38d0a86..9110632e88 100644 --- a/src/NSwag.Generation.AspNetCore.Tests.Web/NSwag.Generation.AspNetCore.Tests.Web.csproj +++ b/src/NSwag.Generation.AspNetCore.Tests.Web/NSwag.Generation.AspNetCore.Tests.Web.csproj @@ -1,23 +1,13 @@  - net5.0;net6.0;net7.0;netcoreapp2.1;netcoreapp3.1 + net6.0;net7.0 true $(NoWarn),618,1591 - - - - - - - - - - diff --git a/src/NSwag.Generation.AspNetCore.Tests.Web/Startup.cs b/src/NSwag.Generation.AspNetCore.Tests.Web/Startup.cs index a85dd0c0f2..3b4a6ed061 100644 --- a/src/NSwag.Generation.AspNetCore.Tests.Web/Startup.cs +++ b/src/NSwag.Generation.AspNetCore.Tests.Web/Startup.cs @@ -1,6 +1,5 @@ using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.AspNetCore.Mvc.Versioning; @@ -18,27 +17,6 @@ public Startup(IConfiguration configuration) public void ConfigureServices(IServiceCollection services) { -#if NETCOREAPP2_1 - services - .AddMvc(config => - { - config.InputFormatters.Add(new CustomTextInputFormatter()); - config.OutputFormatters.Add(new CustomTextOutputFormatter()); - }) - .SetCompatibilityVersion(CompatibilityVersion.Version_2_1); - - services.AddApiVersioning(options => - { - options.AssumeDefaultVersionWhenUnspecified = true; - options.ApiVersionReader = new UrlSegmentApiVersionReader(); - }) - .AddMvcCore() - .AddVersionedApiExplorer(options => - { - options.GroupNameFormat = "VVV"; - options.SubstituteApiVersionInUrl = true; - }); -#else services .AddControllers(config => { @@ -55,8 +33,7 @@ public void ConfigureServices(IServiceCollection services) { options.GroupNameFormat = "VVV"; options.SubstituteApiVersionInUrl = true; - }); -#endif + }); services .AddSwaggerDocument(document => @@ -88,16 +65,11 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env) } app.UseHttpsRedirection(); -#if NETCOREAPP2_1 - app.UseMvc(); -#else app.UseRouting(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); -#endif - app.UseSwagger(); app.UseSwaggerUi3(); diff --git a/src/NSwag.Generation.AspNetCore.Tests/AspNetCoreToSwaggerGenerationTests.cs b/src/NSwag.Generation.AspNetCore.Tests/AspNetCoreToSwaggerGenerationTests.cs deleted file mode 100644 index 04eb15c9b8..0000000000 --- a/src/NSwag.Generation.AspNetCore.Tests/AspNetCoreToSwaggerGenerationTests.cs +++ /dev/null @@ -1,897 +0,0 @@ -#if NETCOREAPP2_1 -//----------------------------------------------------------------------- -// -// Copyright (c) Rico Suter. All rights reserved. -// -// https://github.com/RicoSuter/NSwag/blob/master/LICENSE.md -// Rico Suter, mail@rsuter.com -//----------------------------------------------------------------------- - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.Abstractions; -using Microsoft.AspNetCore.Mvc.ApiExplorer; -using Microsoft.AspNetCore.Mvc.ApplicationModels; -using Microsoft.AspNetCore.Mvc.ApplicationParts; -using Microsoft.AspNetCore.Mvc.Controllers; -using Microsoft.AspNetCore.Mvc.Internal; -using Microsoft.AspNetCore.Mvc.ModelBinding; -using Microsoft.AspNetCore.Mvc.Routing; -using Microsoft.AspNetCore.Routing; -using Microsoft.Extensions.Options; -using Moq; -using NSwag.Annotations; -using NSwag.Generation.Processors; -using NSwag.Generation.Processors.Contexts; -using Xunit; - -namespace NSwag.Generation.AspNetCore.Tests -{ - public class AspNetCoreToSwaggerGenerationTests - { - [Fact] - public async Task SwaggerDocumentIsGeneratedForCustomCreatedApiDescriptions() - { - // Arrange - var generator = new AspNetCoreOpenApiDocumentGenerator(new AspNetCoreOpenApiDocumentGeneratorSettings()); - var apiDescriptions = new[] - { - new ApiDescription - { - ActionDescriptor = new ActionDescriptor(), - }, - new ApiDescription - { - ActionDescriptor = new ControllerActionDescriptor - { - ControllerTypeInfo = typeof(CustomController).GetTypeInfo(), - MethodInfo = typeof(CustomController).GetMethod(nameof(CustomController.FindModel)), - AttributeRouteInfo = new AttributeRouteInfo - { - Template = "api/test/{id}", - }, - ControllerName = "Test", - ActionName = "Find", - }, - HttpMethod = "Get", - RelativePath = "api/test/{id}", - ParameterDescriptions = - { - new ApiParameterDescription - { - Name = "id", - Source = BindingSource.Path, - Type = typeof(int), - }, - }, - SupportedResponseTypes = - { - new ApiResponseType - { - Type = typeof(TestModel), - StatusCode = 200, - } - }, - }, - new ApiDescription - { - ActionDescriptor = new ControllerActionDescriptor - { - ControllerTypeInfo = typeof(CustomController).GetTypeInfo(), - MethodInfo = typeof(CustomController).GetMethod(nameof(CustomController.Delete)), - ControllerName = "Test", - ActionName = "DeleteModel", - }, - HttpMethod = "Delete", - RelativePath = "api/test", - ParameterDescriptions = - { - new ApiParameterDescription - { - Name = "id", - Source = BindingSource.Query, - Type = typeof(int), - }, - }, - SupportedResponseTypes = - { - new ApiResponseType - { - Type = typeof(StatusCodeResult), - StatusCode = 201, - } - }, - }, - new ApiDescription - { - ActionDescriptor = new ControllerActionDescriptor - { - ControllerTypeInfo = typeof(CustomController).GetTypeInfo(), - MethodInfo = typeof(CustomController).GetMethod(nameof(CustomController.Update)), - AttributeRouteInfo = new AttributeRouteInfo - { - Template = "api/test/{id}", - }, - ControllerName = "Test", - ActionName = "Update", - }, - HttpMethod = "Put", - RelativePath = "api/test/{id}", - ParameterDescriptions = - { - new ApiParameterDescription - { - Type = typeof(int), - Name = "id", - Source = BindingSource.Path, - }, - new ApiParameterDescription - { - Type = typeof(TestModel), - Name = "model", - Source = BindingSource.Body, - }, - }, - SupportedResponseTypes = - { - new ApiResponseType - { - Type = typeof(Task), - StatusCode = 200, - } - }, - }, - }; - var apiDescriptionGroupCollection = new ApiDescriptionGroupCollection( - new[] { new ApiDescriptionGroup(string.Empty, apiDescriptions) }, - version: 1); - - // Act - var document = await generator.GenerateAsync(apiDescriptionGroupCollection); - - // Assert - Assert.Collection( - document.Operations.OrderBy(o => o.Method.ToString()), - operation => - { - Assert.Equal("/api/test", operation.Path); - Assert.Equal(OpenApiOperationMethod.Delete, operation.Method); - }, - operation => - { - Assert.Equal("/api/test/{id}", operation.Path); - Assert.Equal(OpenApiOperationMethod.Get, operation.Method); - - Assert.Single(operation.Operation.Responses); - var response = operation.Operation.Responses["200"]; - var definition = document.Definitions.First(f => f.Value == response.Schema?.ActualSchema); - Assert.Equal(nameof(TestModel), definition.Key); - }, - operation => - { - Assert.Equal("/api/test/{id}", operation.Path); - Assert.Equal(OpenApiOperationMethod.Put, operation.Method); - }); - } - - [Fact] - public async Task When_generating_swagger_all_apidescriptions_are_discovered() - { - // Arrange - var generator = new AspNetCoreOpenApiDocumentGenerator(new AspNetCoreOpenApiDocumentGeneratorSettings()); - var apiDescriptions = GetApiDescriptionGroups(typeof(TestController)); - - // Act - var document = await generator.GenerateAsync(apiDescriptions); - - // Assert - var operationDescription = Assert.Single(document.Operations); - Assert.Equal("/test", operationDescription.Path); - Assert.Equal(OpenApiOperationMethod.Get, operationDescription.Method); - - var operation = operationDescription.Operation; - Assert.Equal("Test_FindModel", operation.OperationId); - - var parameter = Assert.Single(operation.Parameters); - Assert.Equal("id", parameter.Name); - Assert.Equal(OpenApiParameterKind.Path, parameter.Kind); - Assert.True(parameter.IsRequired); - Assert.Equal(NJsonSchema.JsonObjectType.Integer, parameter.Type); - - Assert.Single(operation.Responses); - var response = operation.Responses["200"]; - var definition = document.Definitions.First(f => f.Value == response.Schema?.ActualSchema); - Assert.Equal(nameof(TestModel), definition.Key); - } - - [Fact] - public async Task When_generating_swagger_all_apidescriptions_are_discovered_for_2_1_applications() - { - // Arrange - var generator = new AspNetCoreOpenApiDocumentGenerator(new AspNetCoreOpenApiDocumentGeneratorSettings()); - var apiDescriptions = Get2_1_ApiDescriptionGroups(typeof(TestController)); - - // Act - var document = await generator.GenerateAsync(apiDescriptions); - - // Assert - var operationDescription = Assert.Single(document.Operations); - Assert.Equal("/test", operationDescription.Path); - Assert.Equal(OpenApiOperationMethod.Get, operationDescription.Method); - - var operation = operationDescription.Operation; - Assert.Equal("Test_FindModel", operation.OperationId); - - var parameter = Assert.Single(operation.Parameters); - Assert.Equal("id", parameter.Name); - Assert.Equal(OpenApiParameterKind.Path, parameter.Kind); - Assert.True(parameter.IsRequired); - Assert.Equal(NJsonSchema.JsonObjectType.Integer, parameter.Type); - - Assert.Equal(2, operation.Responses.Count); - var response = operation.Responses["200"]; - var definition = document.Definitions.First(f => f.Value == response.Schema?.ActualSchema); - Assert.Equal(nameof(TestModel), definition.Key); - - response = operation.Responses["default"]; - definition = document.Definitions.First(f => f.Value == response.Schema?.ActualSchema); - Assert.Equal(nameof(ProblemDetails), definition.Key); - } - - [Fact] - public async Task ControllersWithSwaggerIgnoreAttribute_AreIgnored() - { - // Arrange - var generator = new AspNetCoreOpenApiDocumentGenerator(new AspNetCoreOpenApiDocumentGeneratorSettings()); - var apiDescriptions = GetApiDescriptionGroups(typeof(ControllerWithSwaggerIgnoreAttribute)); - - // Act - var document = await generator.GenerateAsync(apiDescriptions); - - // Assert - Assert.Empty(document.Operations); - } - - [Fact] - public async Task ActionsWithSwaggerIgnoreAttribute_AreIgnored() - { - // Arrange - var generator = new AspNetCoreOpenApiDocumentGenerator(new AspNetCoreOpenApiDocumentGeneratorSettings()); - var apiDescriptions = GetApiDescriptionGroups(typeof(ActionWithSwaggerIgnoreAttribute)); - - // Act - var document = await generator.GenerateAsync(apiDescriptions); - - // Assert - var operationDescription = Assert.Single(document.Operations); - Assert.Equal("/test1", operationDescription.Path); - Assert.Equal(OpenApiOperationMethod.Get, operationDescription.Method); - } - - [Fact] - public async Task ParametersWithSwaggerIgnoreAttribute_AreIgnored() - { - // Arrange - var generator = new AspNetCoreOpenApiDocumentGenerator(new AspNetCoreOpenApiDocumentGeneratorSettings()); - var apiDescriptions = GetApiDescriptionGroups(typeof(ParameterWithSwaggerIgnoreAttribute)); - - // Act - var document = await generator.GenerateAsync(apiDescriptions); - - // Assert - var operationDescription = Assert.Single(document.Operations); - Assert.Equal("/{id}", operationDescription.Path); - Assert.Equal(OpenApiOperationMethod.Post, operationDescription.Method); - - var parameter = Assert.Single(operationDescription.Operation.Parameters); - Assert.Equal("id", parameter.Name); - Assert.Equal(OpenApiParameterKind.Path, parameter.Kind); - } - - [Fact] - public async Task SwaggerOperationMethods_AreParsed() - { - // Arrange - var generator = new AspNetCoreOpenApiDocumentGenerator(new AspNetCoreOpenApiDocumentGeneratorSettings()); - var apiDescriptions = GetApiDescriptionGroups(typeof(HttpMethodsController)); - - // Act - var document = await generator.GenerateAsync(apiDescriptions); - - // Assert - Assert.Collection( - document.Operations.OrderBy(o => o.Method.ToString()), - operation => - { - Assert.Equal(OpenApiOperationMethod.Delete, operation.Method); - Assert.Equal("HttpMethods_HttpDelete", operation.Operation.OperationId); - }, - operation => - { - Assert.Equal(OpenApiOperationMethod.Head, operation.Method); - Assert.Equal("HttpMethods_HttpHead", operation.Operation.OperationId); - }, - operation => - { - Assert.Equal(OpenApiOperationMethod.Options, operation.Method); - Assert.Equal("HttpMethods_HttpOptions", operation.Operation.OperationId); - }, - operation => - { - Assert.Equal(OpenApiOperationMethod.Patch, operation.Method); - Assert.Equal("HttpMethods_HttpPatch", operation.Operation.OperationId); - }); - } - - [Fact] - public async Task SwaggerOperationAttribute_AreUsedToCalculateOperationId_IfPresent() - { - // Arrange - var generator = new AspNetCoreOpenApiDocumentGenerator(new AspNetCoreOpenApiDocumentGeneratorSettings()); - var apiDescriptions = GetApiDescriptionGroups(typeof(ActionWithSwaggerOperationAttribute)); - - // Act - var document = await generator.GenerateAsync(apiDescriptions); - - // Assert - var operation = Assert.Single(document.Operations); - Assert.Equal("CustomOperationId", operation.Operation.OperationId); - } - - [Fact] - public async Task SwaggerOperationProcessorAttributesOnControllerTypes_AreDiscoveredAndExecuted() - { - // Arrange - var generator = new AspNetCoreOpenApiDocumentGenerator(new AspNetCoreOpenApiDocumentGeneratorSettings()); - var apiDescriptions = GetApiDescriptionGroups(typeof(ControllerWithSwaggerOperationProcessor)); - - // Act - var document = await generator.GenerateAsync(apiDescriptions); - - // Assert - Assert.Equal("Hello from controller", document.Info.Title); - } - - [Fact] - public async Task SwaggerOperationProcessorAttributesOnActions_AreDiscoveredAndExecuted() - { - // Arrange - var generator = new AspNetCoreOpenApiDocumentGenerator(new AspNetCoreOpenApiDocumentGeneratorSettings()); - var apiDescriptions = GetApiDescriptionGroups(typeof(ActionWithSwaggerOperationProcessor)); - - // Act - var document = await generator.GenerateAsync(apiDescriptions); - - // Assert - Assert.Equal("Hello from action", document.Info.Title); - } - - [Fact] - public async Task SwaggerResponseAttributesOnControllersAreDiscovered() - { - // Arrange - var generator = new AspNetCoreOpenApiDocumentGenerator(new AspNetCoreOpenApiDocumentGeneratorSettings()); - var apiDescriptions = GetApiDescriptionGroups(typeof(ControllerWithSwaggerResponseTypeAttribute)); - - // Act - var document = await generator.GenerateAsync(apiDescriptions); - - // Assert - var operation = Assert.Single(document.Operations); - Assert.Single(operation.Operation.Responses); - var response = operation.Operation.Responses["202"]; - var definition = document.Definitions.First(f => f.Value == response.Schema?.ActualSchema); - Assert.Equal(nameof(TestModel), definition.Key); - } - - [Fact] - public async Task SwaggerResponseAttributesOnActionsAreDiscovered() - { - // Arrange - var generator = new AspNetCoreOpenApiDocumentGenerator(new AspNetCoreOpenApiDocumentGeneratorSettings()); - var apiDescriptions = GetApiDescriptionGroups(typeof(ActionWithSwaggerResponseAttribute)); - - // Act - var document = await generator.GenerateAsync(apiDescriptions); - - // Assert - var operation = Assert.Single(document.Operations); - Assert.Single(operation.Operation.Responses); - var response = operation.Operation.Responses["201"]; - var definition = document.Definitions.First(f => f.Value == response.Schema?.ActualSchema); - Assert.Equal(nameof(TestModel), definition.Key); - } - - [Fact] - public async Task FromHeaderParametersAreDiscovered() - { - // Arrange - var generator = new AspNetCoreOpenApiDocumentGenerator(new AspNetCoreOpenApiDocumentGeneratorSettings()); - var apiDescriptions = GetApiDescriptionGroups(typeof(ControllerWithParameters)); - - // Act - var document = await generator.GenerateAsync(apiDescriptions); - - // Assert - var operation = Assert.Single(document.Operations, o => o.Path == "/" + nameof(ControllerWithParameters.FromHeaderParameter)).Operation; - var parameter = Assert.Single(operation.Parameters); - Assert.Equal(OpenApiParameterKind.Header, parameter.Kind); - Assert.Equal("headerParameter", parameter.Name); - } - - [Fact] - public async Task FromBodyParametersAreDiscovered() - { - // Arrange - var generator = new AspNetCoreOpenApiDocumentGenerator(new AspNetCoreOpenApiDocumentGeneratorSettings()); - var apiDescriptions = GetApiDescriptionGroups(typeof(ControllerWithParameters)); - - // Act - var document = await generator.GenerateAsync(apiDescriptions); - - // Assert - var operation = Assert.Single(document.Operations, o => o.Path == "/" + nameof(ControllerWithParameters.FromBodyParameter)).Operation; - var parameter = Assert.Single(operation.Parameters); - Assert.Equal(OpenApiParameterKind.Body, parameter.Kind); - Assert.Equal("model", parameter.Name); - Assert.True(parameter.IsRequired); - } - - [Fact] - public async Task FromFormParametersAreDiscovered() - { - // Arrange - var generator = new AspNetCoreOpenApiDocumentGenerator(new AspNetCoreOpenApiDocumentGeneratorSettings { RequireParametersWithoutDefault = true }); - var apiDescriptions = GetApiDescriptionGroups(typeof(ControllerWithParameters)); - - // Act - var document = await generator.GenerateAsync(apiDescriptions); - - // Assert - var operation = Assert.Single(document.Operations, o => o.Path == "/" + nameof(ControllerWithParameters.FromFormParameter)).Operation; - var parameter = Assert.Single(operation.Parameters); - Assert.Equal(OpenApiParameterKind.FormData, parameter.Kind); - Assert.Equal("formParameter", parameter.Name); - Assert.True(parameter.IsRequired); - } - - [Fact] - public async Task QueryParametersAreDiscovered() - { - // Arrange - var generator = new AspNetCoreOpenApiDocumentGenerator(new AspNetCoreOpenApiDocumentGeneratorSettings { RequireParametersWithoutDefault = true }); - var apiDescriptions = GetApiDescriptionGroups(typeof(ControllerWithParameters)); - - // Act - var document = await generator.GenerateAsync(apiDescriptions); - - // Assert - var operation = Assert.Single(document.Operations, o => o.Path == "/" + nameof(ControllerWithParameters.QueryParameter)).Operation; - var requiredParameter = operation.Parameters.First(); - var optionalParameter = operation.Parameters.Last(); - - Assert.Equal(OpenApiParameterKind.Query, requiredParameter.Kind); - Assert.Equal(OpenApiParameterKind.Query, optionalParameter.Kind); - - Assert.Equal("queryParameter1", requiredParameter.Name); - Assert.Equal("queryParameter2", optionalParameter.Name); - - Assert.True(requiredParameter.IsRequired); - Assert.False(optionalParameter.IsRequired); - } - - [Fact] - public async Task FormFileParametersAreDiscovered() - { - // Arrange - var generator = new AspNetCoreOpenApiDocumentGenerator(new AspNetCoreOpenApiDocumentGeneratorSettings()); - var apiDescriptions = GetApiDescriptionGroups(typeof(ControllerWithParameters)); - - // Act - var document = await generator.GenerateAsync(apiDescriptions); - - // Assert - var operation = Assert.Single(document.Operations, o => o.Path == "/" + nameof(ControllerWithParameters.FileParameter)).Operation; - var parameter = Assert.Single(operation.Parameters); - Assert.Equal(OpenApiParameterKind.FormData, parameter.Kind); - Assert.Equal("multipart/form-data", Assert.Single(operation.Consumes)); - } - - [Fact] - public async Task ComplexQueryParametersAreProcessed() - { - // Arrange - var generator = new AspNetCoreOpenApiDocumentGenerator(new AspNetCoreOpenApiDocumentGeneratorSettings()); - var apiDescriptions = GetApiDescriptionGroups(typeof(ControllerWithParameters)); - - // Act - var document = await generator.GenerateAsync(apiDescriptions); - - // Assert - var operation = Assert.Single(document.Operations, o => o.Path == "/" + nameof(ControllerWithParameters.ComplexFromQueryParameter)).Operation; - Assert.Collection( - operation.Parameters.OrderBy(p => p.Name), - parameter => - { - Assert.Equal(nameof(ComplexModel.Header), parameter.Name); - Assert.Equal(OpenApiParameterKind.Query, parameter.Kind); - }, - parameter => - { - Assert.Equal(nameof(ComplexModel.Id), parameter.Name); - Assert.Equal(OpenApiParameterKind.Query, parameter.Kind); - }, - parameter => - { - Assert.Equal(nameof(ComplexModel.QueryValues), parameter.Name); - Assert.Equal(OpenApiParameterKind.Query, parameter.Kind); - }); - } - - [Fact] - public async Task BoundPropertiesAreProcessed() - { - // Arrange - var generator = new AspNetCoreOpenApiDocumentGenerator(new AspNetCoreOpenApiDocumentGeneratorSettings()); - var apiDescriptions = GetApiDescriptionGroups(typeof(ControllerWithBoundProperties)); - - // Act - var document = await generator.GenerateAsync(apiDescriptions); - - // Assert - var operation = Assert.Single(document.Operations).Operation; - Assert.Collection( - operation.Parameters.OrderBy(p => p.Name), - parameter => - { - Assert.Equal(nameof(ControllerWithBoundProperties.HeaderValue), parameter.Name); - Assert.Equal(OpenApiParameterKind.Header, parameter.Kind); - }, - parameter => - { - Assert.Equal(nameof(ControllerWithBoundProperties.Id), parameter.Name); - Assert.Equal(OpenApiParameterKind.Path, parameter.Kind); - }, - parameter => - { - Assert.Equal("model", parameter.Name); - Assert.Equal(OpenApiParameterKind.Body, parameter.Kind); - }); - } - - [Fact] - public async Task When_no_IncludedVersions_are_defined_then_all_routes_are_available_and_replaced() - { - // Arrange - var generator = new AspNetCoreOpenApiDocumentGenerator(new AspNetCoreOpenApiDocumentGeneratorSettings()); - var apiDescriptions = GetApiDescriptionGroups(typeof(ControllerWithReCodeAttribute)); - - // Act - var document = await generator.GenerateAsync(apiDescriptions); - - // Assert - var operation = Assert.Single(document.Operations).Operation; - Assert.True(operation.ExtensionData.ContainsKey("x-code-samples")); - var extenstionData = (IList)operation.ExtensionData["x-code-samples"]; - Assert.Equal(2, extenstionData.Count); - } - - #region Controllers - - private class CustomController - { - public IActionResult FindModel(int id) => null; - - [HttpDelete] - public IActionResult Delete(int id) => null; - - [HttpPut] - public IActionResult Update(int id, TestModel model) => null; - } - - private class TestController : ControllerBase - { - [HttpGet("/test")] - public Task FindModel([FromRoute] int id) => null; - } - - [SwaggerIgnore] - private class ControllerWithSwaggerIgnoreAttribute - { - [HttpGet("/test")] - public Task FindModel([FromRoute] int id) => null; - } - - private class ActionWithSwaggerIgnoreAttribute - { - [HttpGet("/test1")] - public Task PublicApi() => null; - - [SwaggerIgnore] - [HttpGet("/test2")] - public Task SecretApi([FromRoute] int id) => null; - } - - private class ParameterWithSwaggerIgnoreAttribute - { - [HttpPost("{id}/{name?}")] - public Task GetModel([FromRoute] int id, [FromRoute] [SwaggerIgnore] string name) => null; - } - - [Route("[controller]/[action]")] - public class HttpMethodsController - { - [AcceptVerbs("Delete")] - public void HttpDelete() { } - - [AcceptVerbs("pAtch")] - public void HttpPatch() { } - - [HttpHead] - public void HttpHead() { } - - [AcceptVerbs("OPTIONS")] - public void HttpOptions() { } - } - - public class ActionWithSwaggerOperationAttribute - { - [HttpGet("/test")] - [SwaggerOperation("CustomOperationId")] - public void TestAction() { } - } - - [SwaggerOperationProcessor(typeof(TestSwaggerOperationProcessor), "Hello from controller")] - public class ControllerWithSwaggerOperationProcessor - { - [HttpGet("/test")] - public void TestAction() { } - } - - public class ActionWithSwaggerOperationProcessor - { - [SwaggerOperationProcessor(typeof(TestSwaggerOperationProcessor), "Hello from action")] - [HttpGet("/test")] - public void TestAction() { } - } - - private class TestSwaggerOperationProcessor : IOperationProcessor - { - public TestSwaggerOperationProcessor(string value) - { - Value = value; - } - - public string Value { get; } - - public bool Process(OperationProcessorContext context) - { - context.Document.Info.Title = Value; - return true; - } - } - - [SwaggerResponse(202, typeof(TestModel))] - private class ControllerWithSwaggerResponseTypeAttribute - { - [HttpPut("/test1")] - public IActionResult UpdateModel(int id) => null; - } - - private class ActionWithSwaggerResponseAttribute - { - [SwaggerResponse(201, typeof(TestModel))] - [HttpPut("/test1")] - public IActionResult CreateModel(int id) => null; - } - - private class ControllerWithParameters - { - [HttpPost(nameof(FromHeaderParameter))] - public IActionResult FromHeaderParameter([FromHeader] string headerParameter) => null; - - [HttpPost(nameof(FromBodyParameter))] - public IActionResult FromBodyParameter([FromBody] TestModel model) => null; - - [HttpPost(nameof(FromFormParameter))] - public IActionResult FromFormParameter([FromForm] string formParameter) => null; - - [HttpPost(nameof(FileParameter))] - public IActionResult FileParameter(IFormFileCollection formFiles) => null; - - [HttpPost(nameof(ComplexFromQueryParameter))] - public IActionResult ComplexFromQueryParameter(ComplexModel model) => null; - - [HttpPost(nameof(QueryParameter))] - public IActionResult QueryParameter(string queryParameter1, string queryParameter2 = null) => null; - } - - private class ControllerWithBoundProperties - { - [FromRoute] - public int Id { get; set; } - - [FromHeader] - public string HeaderValue { get; set; } - - [HttpPost("Action")] - public IActionResult TestAction([FromBody] TestModel model) => null; - } - - public class ControllerWithReCodeAttribute - { - [HttpGet("Action")] - [ReDocCodeSample("foo", "bar")] - [ReDocCodeSample("baz", "buz")] - public void Run() - { - } - } - - private class TestModel { } - - private class ComplexModel - { - [FromRoute] - public int Id { get; set; } - - [FromBody] - public string Header { get; set; } - - [FromQuery(Name = "q")] - public int[] QueryValues { get; set; } - } - - private class CustomBindingSourceAttribute : Attribute, IBindingSourceMetadata - { - public BindingSource BindingSource => BindingSource.ModelBinding; - } - - public class ReDocCodeSampleAttribute : SwaggerOperationProcessorAttribute - { - public ReDocCodeSampleAttribute(string language, string source) - : base(typeof(ReDocCodeSampleAppender), language, source) - { - } - - internal class ReDocCodeSampleAppender : IOperationProcessor - { - private readonly string _language; - private readonly string _source; - private const string ExtensionKey = "x-code-samples"; - - public ReDocCodeSampleAppender(string language, string source) - { - _language = language; - _source = source; - } - - public bool Process(OperationProcessorContext context) - { - if (context.OperationDescription.Operation.ExtensionData == null) - { - context.OperationDescription.Operation.ExtensionData = new Dictionary(); - } - - var data = context.OperationDescription.Operation.ExtensionData; - if (!data.ContainsKey(ExtensionKey)) - { - data[ExtensionKey] = new List(); - } - - var samples = (List)data[ExtensionKey]; - samples.Add(new ReDocCodeSample - { - Language = _language, - Source = _source, - }); - - return true; - } - } - - public class ReDocCodeSample - { - public string Language { get; set; } - - public string Source { get; set; } - } - } - - #endregion - - #region ApiDescription generation - - private static ApiDescriptionGroupCollection GetApiDescriptionGroups(Type controllerType) - { - var options = Mock.Of>(m => m.Value == new MvcOptions()); - var applicationPartManager = new ApplicationPartManager(); - applicationPartManager.FeatureProviders.Add(new TestControllerFeatureProvider(controllerType)); - - var actionDescriptorProvider = new ControllerActionDescriptorProvider( - applicationPartManager, - new IApplicationModelProvider[] - { - new DefaultApplicationModelProvider(options, new EmptyModelMetadataProvider()), - new MakeApiExplorerVisibleProvider(), - }, - options); - - var actionDescriptorProviderContext = new ActionDescriptorProviderContext(); - actionDescriptorProvider.OnProvidersExecuting(actionDescriptorProviderContext); - - var apiDescriptionProvider = new DefaultApiDescriptionProvider(options, Mock.Of(), - new EmptyModelMetadataProvider(), new ActionResultTypeMapper()); - - var apiDescriptionProviderContext = new ApiDescriptionProviderContext(actionDescriptorProviderContext.Results.ToArray()); - apiDescriptionProvider.OnProvidersExecuting(apiDescriptionProviderContext); - - var groups = apiDescriptionProviderContext.Results.GroupBy(a => a.GroupName) - .Select(g => new ApiDescriptionGroup(g.Key, g.ToArray())) - .ToArray(); - - return new ApiDescriptionGroupCollection(groups, version: 1); - } - - private static ApiDescriptionGroupCollection Get2_1_ApiDescriptionGroups(Type controllerType) - { - var apiDescriptionGroup = GetApiDescriptionGroups(controllerType); - foreach (var apiDescription in apiDescriptionGroup.Items.SelectMany(c => c.Items)) - { - apiDescription.SupportedResponseTypes.Add(new ApiResponseType2_1 - { - StatusCode = 0, - Type = typeof(ProblemDetails), - IsDefaultResponse = true, - }); - } - - return apiDescriptionGroup; - } - - private class TestControllerFeatureProvider : IApplicationFeatureProvider - { - private readonly Type _controllerType; - - public TestControllerFeatureProvider(Type controllerType) - { - _controllerType = controllerType; - } - - public void PopulateFeature(IEnumerable parts, ControllerFeature feature) - { - feature.Controllers.Add(_controllerType.GetTypeInfo()); - } - } - - private class MakeApiExplorerVisibleProvider : IApplicationModelProvider - { - public int Order => 0; - - public void OnProvidersExecuted(ApplicationModelProviderContext context) - { - } - - public void OnProvidersExecuting(ApplicationModelProviderContext context) - { - context.Result.ApiExplorer.IsVisible = true; - } - } - - private class ProblemDetails { } - - private class ApiResponseType2_1 : ApiResponseType - { -#pragma warning disable 108,114 - public bool IsDefaultResponse { get; set; } -#pragma warning restore 108,114 - } - #endregion - } -} -#endif diff --git a/src/NSwag.Generation.AspNetCore.Tests/NSwag.Generation.AspNetCore.Tests.csproj b/src/NSwag.Generation.AspNetCore.Tests/NSwag.Generation.AspNetCore.Tests.csproj index 6f9e6b1267..3f889218e0 100644 --- a/src/NSwag.Generation.AspNetCore.Tests/NSwag.Generation.AspNetCore.Tests.csproj +++ b/src/NSwag.Generation.AspNetCore.Tests/NSwag.Generation.AspNetCore.Tests.csproj @@ -1,6 +1,6 @@  - netcoreapp2.1;netcoreapp3.1;net5.0;net6.0;net7.0 + net6.0;net7.0 $(NoWarn),618,1591 @@ -11,23 +11,10 @@ - - - - - - + - - - - - - - - diff --git a/src/NSwag.Generation.AspNetCore/NSwag.Generation.AspNetCore.csproj b/src/NSwag.Generation.AspNetCore/NSwag.Generation.AspNetCore.csproj index 9b0b7c4e90..198dccdf24 100644 --- a/src/NSwag.Generation.AspNetCore/NSwag.Generation.AspNetCore.csproj +++ b/src/NSwag.Generation.AspNetCore/NSwag.Generation.AspNetCore.csproj @@ -1,33 +1,21 @@  - netstandard1.6;net461;netstandard2.0;netcoreapp3.1;net5.0;net6.0;net7.0 + net462;netstandard2.0;net6.0;net7.0 Swagger Documentation AspNetCore $(DefineConstants);ASPNETCORE bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml - + - + - - - - - - - - - - - - diff --git a/src/NSwag.Generation.Tests/NSwag.Generation.Tests.csproj b/src/NSwag.Generation.Tests/NSwag.Generation.Tests.csproj index 7b21162bb1..27a6709995 100644 --- a/src/NSwag.Generation.Tests/NSwag.Generation.Tests.csproj +++ b/src/NSwag.Generation.Tests/NSwag.Generation.Tests.csproj @@ -1,7 +1,7 @@ - netcoreapp3.1 + net6.0 false true $(NoWarn);1591 diff --git a/src/NSwag.Generation.WebApi/NSwag.Generation.WebApi.csproj b/src/NSwag.Generation.WebApi/NSwag.Generation.WebApi.csproj index ecba6cd684..4f462872ca 100644 --- a/src/NSwag.Generation.WebApi/NSwag.Generation.WebApi.csproj +++ b/src/NSwag.Generation.WebApi/NSwag.Generation.WebApi.csproj @@ -1,7 +1,7 @@  - netstandard1.0;net45;netstandard2.0 + net462;netstandard2.0 bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml @@ -9,7 +9,7 @@ - + diff --git a/src/NSwag.Generation/NSwag.Generation.csproj b/src/NSwag.Generation/NSwag.Generation.csproj index 7a8080b0ff..45f5bd3a05 100644 --- a/src/NSwag.Generation/NSwag.Generation.csproj +++ b/src/NSwag.Generation/NSwag.Generation.csproj @@ -1,6 +1,6 @@  - netstandard1.0;net45;netstandard2.0 + net462;netstandard2.0 bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml $(NoWarn),618 @@ -11,7 +11,7 @@ - + diff --git a/src/NSwag.Integration.ClientPCL/NSwag.Integration.ClientPCL.csproj b/src/NSwag.Integration.ClientPCL/NSwag.Integration.ClientPCL.csproj index 518362cb56..c87feaa9b8 100644 --- a/src/NSwag.Integration.ClientPCL/NSwag.Integration.ClientPCL.csproj +++ b/src/NSwag.Integration.ClientPCL/NSwag.Integration.ClientPCL.csproj @@ -1,6 +1,6 @@  - netstandard1.4 + netstandard2.0 diff --git a/src/NSwag.Integration.Console/NSwag.Integration.Console.csproj b/src/NSwag.Integration.Console/NSwag.Integration.Console.csproj index 9b3d33fca5..e5d64ff97e 100644 --- a/src/NSwag.Integration.Console/NSwag.Integration.Console.csproj +++ b/src/NSwag.Integration.Console/NSwag.Integration.Console.csproj @@ -1,7 +1,7 @@  Exe - net46 + net462 true win NSwag.Integration.Console diff --git a/src/NSwag.Integration.TypeScriptWeb/package-lock.json b/src/NSwag.Integration.TypeScriptWeb/package-lock.json index 4517fe7926..2780378fc5 100644 --- a/src/NSwag.Integration.TypeScriptWeb/package-lock.json +++ b/src/NSwag.Integration.TypeScriptWeb/package-lock.json @@ -1,27 +1,248 @@ { "name": "nswag-integration-typescriptweb", + "lockfileVersion": 2, "requires": true, - "lockfileVersion": 1, + "packages": { + "": { + "name": "nswag-integration-typescriptweb", + "license": "MIT", + "dependencies": { + "@angular/common": "^2.4.8", + "@angular/core": "^2.4.8", + "@angular/http": "^2.4.8", + "@angular/platform-browser": "^2.4.8", + "aurelia-fetch-client": "^1.1.1", + "aurelia-framework": "^1.1.0", + "rxjs": "^5.2.0", + "zone.js": "^0.7.7" + }, + "devDependencies": { + "@types/angular": "^1.6.7", + "@types/jasmine": "^2.5.43", + "@types/jquery": "^2.0.40", + "@types/knockout": "^3.4.39", + "typescript": "^2.2.1" + } + }, + "node_modules/@angular/common": { + "version": "2.4.10", + "resolved": "https://registry.npmjs.org/@angular/common/-/common-2.4.10.tgz", + "integrity": "sha1-o6aC0iKPow7CPdDrV8joh/uiaZc=", + "peerDependencies": { + "@angular/core": "2.4.10" + } + }, + "node_modules/@angular/core": { + "version": "2.4.10", + "resolved": "https://registry.npmjs.org/@angular/core/-/core-2.4.10.tgz", + "integrity": "sha1-C4MgplBlll2ZhkWx9c0892m0Qeo=", + "peerDependencies": { + "rxjs": "^5.0.1", + "zone.js": "^0.7.2" + } + }, + "node_modules/@angular/http": { + "version": "2.4.10", + "resolved": "https://registry.npmjs.org/@angular/http/-/http-2.4.10.tgz", + "integrity": "sha1-/2vq3ls5yYnr8jk8SbNO69Q+lVU=", + "deprecated": "Package no longer supported. Use @angular/common instead, see https://angular.io/guide/deprecations#angularhttp", + "peerDependencies": { + "@angular/core": "2.4.10", + "@angular/platform-browser": "2.4.10", + "rxjs": "^5.0.1" + } + }, + "node_modules/@angular/platform-browser": { + "version": "2.4.10", + "resolved": "https://registry.npmjs.org/@angular/platform-browser/-/platform-browser-2.4.10.tgz", + "integrity": "sha1-y/JWCBSPtP/vlsxQBbpdez4JOQY=", + "peerDependencies": { + "@angular/common": "2.4.10", + "@angular/core": "2.4.10" + } + }, + "node_modules/@types/angular": { + "version": "1.6.32", + "resolved": "https://registry.npmjs.org/@types/angular/-/angular-1.6.32.tgz", + "integrity": "sha512-xpx7oFBN2oQEwtD80m+aI8wpejzGvlgkgzYD+MpxFTyJtlbwUUUIaJEaEJOtgtF/9Fndt3q6W1qNGf7vO2AUjw==", + "dev": true + }, + "node_modules/@types/jasmine": { + "version": "2.5.54", + "resolved": "https://registry.npmjs.org/@types/jasmine/-/jasmine-2.5.54.tgz", + "integrity": "sha512-B9YofFbUljs19g5gBKUYeLIulsh31U5AK70F41BImQRHEZQGm4GcN922UvnYwkduMqbC/NH+9fruWa/zrqvHIg==", + "dev": true + }, + "node_modules/@types/jquery": { + "version": "2.0.48", + "resolved": "https://registry.npmjs.org/@types/jquery/-/jquery-2.0.48.tgz", + "integrity": "sha512-nNLzUrVjaRV/Ds1eHZLYTd7IZxs38cwwLSaqMJj8OTXY8xNUbxSK69bi9cMLvQ7dm/IBeQ1wHwQ0S1uYa0rd2w==", + "dev": true + }, + "node_modules/@types/knockout": { + "version": "3.4.45", + "resolved": "https://registry.npmjs.org/@types/knockout/-/knockout-3.4.45.tgz", + "integrity": "sha512-RgzIhwDtvem3rHxmyMokAEGsPk/b0npoKUgGkIKXiEj89B1TXXbWd1fC8BPxV/CyPg5kLD5QKK24MzXdU6DDvQ==", + "dev": true + }, + "node_modules/aurelia-binding": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/aurelia-binding/-/aurelia-binding-1.2.2.tgz", + "integrity": "sha1-9A2hsxqmgEbTKqBbz69b0/PklxY=", + "dependencies": { + "aurelia-logging": "^1.0.0", + "aurelia-metadata": "^1.0.0", + "aurelia-pal": "^1.0.0", + "aurelia-task-queue": "^1.0.0" + } + }, + "node_modules/aurelia-dependency-injection": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/aurelia-dependency-injection/-/aurelia-dependency-injection-1.3.2.tgz", + "integrity": "sha1-X5yl3t5qHMxyoIOMmA3z3+eRh1Y=", + "dependencies": { + "aurelia-metadata": "^1.0.0", + "aurelia-pal": "^1.0.0" + } + }, + "node_modules/aurelia-fetch-client": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/aurelia-fetch-client/-/aurelia-fetch-client-1.1.3.tgz", + "integrity": "sha1-O2pLi53kgJ6Za9oSmfBYOMOQewo=" + }, + "node_modules/aurelia-framework": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/aurelia-framework/-/aurelia-framework-1.1.4.tgz", + "integrity": "sha1-TcYwscSCAxZ0ZuXfKHiAP/Qd/2U=", + "dependencies": { + "aurelia-binding": "^1.0.0", + "aurelia-dependency-injection": "^1.0.0", + "aurelia-loader": "^1.0.0", + "aurelia-logging": "^1.0.0", + "aurelia-metadata": "^1.0.0", + "aurelia-pal": "^1.0.0", + "aurelia-path": "^1.0.0", + "aurelia-task-queue": "^1.0.0", + "aurelia-templating": "^1.0.0" + } + }, + "node_modules/aurelia-loader": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/aurelia-loader/-/aurelia-loader-1.0.0.tgz", + "integrity": "sha1-t4wqKBOqjkQSRyN91m/WLl1OGeo=", + "dependencies": { + "aurelia-metadata": "^1.0.0", + "aurelia-path": "^1.0.0" + } + }, + "node_modules/aurelia-logging": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/aurelia-logging/-/aurelia-logging-1.3.1.tgz", + "integrity": "sha1-s0rnWTcroIdAqxIjOom60VSH/pg=" + }, + "node_modules/aurelia-metadata": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/aurelia-metadata/-/aurelia-metadata-1.0.3.tgz", + "integrity": "sha1-Ho1Z2hiOKHGorXSbpCyoUISj8w4=", + "dependencies": { + "aurelia-pal": "^1.0.0" + } + }, + "node_modules/aurelia-pal": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/aurelia-pal/-/aurelia-pal-1.4.0.tgz", + "integrity": "sha1-EUjyVshUwOAgoKj0Zcv0pu6vkYg=" + }, + "node_modules/aurelia-path": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/aurelia-path/-/aurelia-path-1.1.7.tgz", + "integrity": "sha512-D6/Tz8jE8b2+Y8Pt6P/fxF6xfJGef+TA6YEljzo1kEzyzbxIvwfqc7pK6i/XGY3LowlumPqrhxkfMjPxLpFIcA==" + }, + "node_modules/aurelia-task-queue": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/aurelia-task-queue/-/aurelia-task-queue-1.2.0.tgz", + "integrity": "sha1-kjOsMOwQtiARO7qzcCSijmH1mGU=", + "dependencies": { + "aurelia-pal": "^1.0.0" + } + }, + "node_modules/aurelia-templating": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/aurelia-templating/-/aurelia-templating-1.4.2.tgz", + "integrity": "sha1-R5zkdwWglf1jbgl1yct5y+5+18s=", + "dependencies": { + "aurelia-binding": "^1.0.0", + "aurelia-dependency-injection": "^1.0.0", + "aurelia-loader": "^1.0.0", + "aurelia-logging": "^1.0.0", + "aurelia-metadata": "^1.0.0", + "aurelia-pal": "^1.0.0", + "aurelia-path": "^1.0.0", + "aurelia-task-queue": "^1.1.0" + } + }, + "node_modules/rxjs": { + "version": "5.4.3", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-5.4.3.tgz", + "integrity": "sha512-fSNi+y+P9ss+EZuV0GcIIqPUK07DEaMRUtLJvdcvMyFjc9dizuDjere+A4V7JrLGnm9iCc+nagV/4QdMTkqC4A==", + "dependencies": { + "symbol-observable": "^1.0.1" + }, + "engines": { + "npm": ">=2.0.0" + } + }, + "node_modules/symbol-observable": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.0.4.tgz", + "integrity": "sha1-Kb9hXUqnEhvdiYsi1LP5vE4qoD0=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/typescript": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.4.2.tgz", + "integrity": "sha1-+DlfhdRZJ2BnyYiqQYN6j4KHCEQ=", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/zone.js": { + "version": "0.7.8", + "resolved": "https://registry.npmjs.org/zone.js/-/zone.js-0.7.8.tgz", + "integrity": "sha1-Tz/og01EWX8mOQU6D6Q43zT//e0=" + } + }, "dependencies": { "@angular/common": { "version": "2.4.10", "resolved": "https://registry.npmjs.org/@angular/common/-/common-2.4.10.tgz", - "integrity": "sha1-o6aC0iKPow7CPdDrV8joh/uiaZc=" + "integrity": "sha1-o6aC0iKPow7CPdDrV8joh/uiaZc=", + "requires": {} }, "@angular/core": { "version": "2.4.10", "resolved": "https://registry.npmjs.org/@angular/core/-/core-2.4.10.tgz", - "integrity": "sha1-C4MgplBlll2ZhkWx9c0892m0Qeo=" + "integrity": "sha1-C4MgplBlll2ZhkWx9c0892m0Qeo=", + "requires": {} }, "@angular/http": { "version": "2.4.10", "resolved": "https://registry.npmjs.org/@angular/http/-/http-2.4.10.tgz", - "integrity": "sha1-/2vq3ls5yYnr8jk8SbNO69Q+lVU=" + "integrity": "sha1-/2vq3ls5yYnr8jk8SbNO69Q+lVU=", + "requires": {} }, "@angular/platform-browser": { "version": "2.4.10", "resolved": "https://registry.npmjs.org/@angular/platform-browser/-/platform-browser-2.4.10.tgz", - "integrity": "sha1-y/JWCBSPtP/vlsxQBbpdez4JOQY=" + "integrity": "sha1-y/JWCBSPtP/vlsxQBbpdez4JOQY=", + "requires": {} }, "@types/angular": { "version": "1.6.32", diff --git a/src/NSwag.Integration.WebAPI/NSwag.Integration.WebAPI.csproj b/src/NSwag.Integration.WebAPI/NSwag.Integration.WebAPI.csproj index 6365d73cd2..50e2966772 100644 --- a/src/NSwag.Integration.WebAPI/NSwag.Integration.WebAPI.csproj +++ b/src/NSwag.Integration.WebAPI/NSwag.Integration.WebAPI.csproj @@ -13,7 +13,7 @@ Properties NSwag.Integration.WebAPI NSwag.Integration.WebAPI - v4.6.1 + v4.6.2 win true diff --git a/src/NSwag.MSBuild/NSwag.MSBuild.nuspec b/src/NSwag.MSBuild/NSwag.MSBuild.nuspec index 85441f8d12..158183490b 100644 --- a/src/NSwag.MSBuild/NSwag.MSBuild.nuspec +++ b/src/NSwag.MSBuild/NSwag.MSBuild.nuspec @@ -21,16 +21,13 @@ - - - - - + + + + + - - - - - + + diff --git a/src/NSwag.MSBuild/NSwag.MSBuild.props b/src/NSwag.MSBuild/NSwag.MSBuild.props index e60a59d7a3..8cc764e2fe 100644 --- a/src/NSwag.MSBuild/NSwag.MSBuild.props +++ b/src/NSwag.MSBuild/NSwag.MSBuild.props @@ -3,16 +3,10 @@ "$(MSBuildThisFileDirectory)../tools/Win/NSwag.exe" "$(MSBuildThisFileDirectory)../tools/Win/NSwag.x86.exe" - dotnet "$(MSBuildThisFileDirectory)../tools/NetCore21/dotnet-nswag.dll" - dotnet "$(MSBuildThisFileDirectory)../tools/NetCore31/dotnet-nswag.dll" - dotnet "$(MSBuildThisFileDirectory)../tools/Net50/dotnet-nswag.dll" dotnet "$(MSBuildThisFileDirectory)../tools/Net60/dotnet-nswag.dll" dotnet "$(MSBuildThisFileDirectory)../tools/Net70/dotnet-nswag.dll" $(MSBuildThisFileDirectory)../tools/Win/ - $(MSBuildThisFileDirectory)../tools/NetCore21/ - $(MSBuildThisFileDirectory)../tools/NetCore31/ - $(MSBuildThisFileDirectory)../tools/Net50/ $(MSBuildThisFileDirectory)../tools/Net60/ $(MSBuildThisFileDirectory)../tools/Net70/ diff --git a/src/NSwag.Min.sln b/src/NSwag.Min.sln index 524dc61eda..1ec72cb6e2 100644 --- a/src/NSwag.Min.sln +++ b/src/NSwag.Min.sln @@ -45,8 +45,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NSwag.Generation.AspNetCore EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NSwag.Generation.AspNetCore.Tests.Web", "NSwag.Generation.AspNetCore.Tests.Web\NSwag.Generation.AspNetCore.Tests.Web.csproj", "{C56AC38A-513B-40C6-AEB8-0146BB5B2888}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NSwag.Sample.NETCore21", "NSwag.Sample.NETCore21\NSwag.Sample.NETCore21.csproj", "{B024633F-AA96-4551-AB18-2EF9650425AF}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NSwag.Core.Yaml.Tests", "NSwag.Core.Yaml.Tests\NSwag.Core.Yaml.Tests.csproj", "{9829DFE2-7F49-40E3-B6A5-AEBB42D1DB33}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NSwag.CodeGeneration.CSharp.Tests", "NSwag.CodeGeneration.CSharp.Tests\NSwag.CodeGeneration.CSharp.Tests.csproj", "{C7923A8B-D0CE-4FD8-ADA0-7507D5F3F693}" @@ -69,10 +67,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NSwag.AssemblyLoader.Tests" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NSwag.Generation.Tests", "NSwag.Generation.Tests\NSwag.Generation.Tests.csproj", "{3A6CA187-AD6F-438C-9E5B-B2771F75AF41}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NSwag.Sample.NET50", "NSwag.Sample.NET50\NSwag.Sample.NET50.csproj", "{F109D48B-A2FF-497D-8374-FEA60C5F2365}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NSwag.Sample.NETCore31", "NSwag.Sample.NETCore31\NSwag.Sample.NETCore31.csproj", "{FC20849C-915D-411B-8CFB-915B7751D898}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NSwag.Sample.NET60", "NSwag.Sample.NET60\NSwag.Sample.NET60.csproj", "{7C9814BB-5B98-43F1-9CD2-4C55CEB9DFBF}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NSwag.Sample.NET60Minimal", "NSwag.Sample.NET60Minimal\NSwag.Sample.NET60Minimal.csproj", "{FA78E42D-F49F-45E3-820E-331FB8E34195}" @@ -358,24 +352,6 @@ Global {C56AC38A-513B-40C6-AEB8-0146BB5B2888}.ReleaseTypeScriptStrict|x64.Build.0 = Release|Any CPU {C56AC38A-513B-40C6-AEB8-0146BB5B2888}.ReleaseTypeScriptStrict|x86.ActiveCfg = Release|Any CPU {C56AC38A-513B-40C6-AEB8-0146BB5B2888}.ReleaseTypeScriptStrict|x86.Build.0 = Release|Any CPU - {B024633F-AA96-4551-AB18-2EF9650425AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B024633F-AA96-4551-AB18-2EF9650425AF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B024633F-AA96-4551-AB18-2EF9650425AF}.Debug|x64.ActiveCfg = Debug|Any CPU - {B024633F-AA96-4551-AB18-2EF9650425AF}.Debug|x64.Build.0 = Debug|Any CPU - {B024633F-AA96-4551-AB18-2EF9650425AF}.Debug|x86.ActiveCfg = Debug|Any CPU - {B024633F-AA96-4551-AB18-2EF9650425AF}.Debug|x86.Build.0 = Debug|Any CPU - {B024633F-AA96-4551-AB18-2EF9650425AF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B024633F-AA96-4551-AB18-2EF9650425AF}.Release|Any CPU.Build.0 = Release|Any CPU - {B024633F-AA96-4551-AB18-2EF9650425AF}.Release|x64.ActiveCfg = Release|Any CPU - {B024633F-AA96-4551-AB18-2EF9650425AF}.Release|x64.Build.0 = Release|Any CPU - {B024633F-AA96-4551-AB18-2EF9650425AF}.Release|x86.ActiveCfg = Release|Any CPU - {B024633F-AA96-4551-AB18-2EF9650425AF}.Release|x86.Build.0 = Release|Any CPU - {B024633F-AA96-4551-AB18-2EF9650425AF}.ReleaseTypeScriptStrict|Any CPU.ActiveCfg = Release|Any CPU - {B024633F-AA96-4551-AB18-2EF9650425AF}.ReleaseTypeScriptStrict|Any CPU.Build.0 = Release|Any CPU - {B024633F-AA96-4551-AB18-2EF9650425AF}.ReleaseTypeScriptStrict|x64.ActiveCfg = Release|Any CPU - {B024633F-AA96-4551-AB18-2EF9650425AF}.ReleaseTypeScriptStrict|x64.Build.0 = Release|Any CPU - {B024633F-AA96-4551-AB18-2EF9650425AF}.ReleaseTypeScriptStrict|x86.ActiveCfg = Release|Any CPU - {B024633F-AA96-4551-AB18-2EF9650425AF}.ReleaseTypeScriptStrict|x86.Build.0 = Release|Any CPU {9829DFE2-7F49-40E3-B6A5-AEBB42D1DB33}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9829DFE2-7F49-40E3-B6A5-AEBB42D1DB33}.Debug|Any CPU.Build.0 = Debug|Any CPU {9829DFE2-7F49-40E3-B6A5-AEBB42D1DB33}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -556,42 +532,6 @@ Global {3A6CA187-AD6F-438C-9E5B-B2771F75AF41}.ReleaseTypeScriptStrict|x64.Build.0 = Release|Any CPU {3A6CA187-AD6F-438C-9E5B-B2771F75AF41}.ReleaseTypeScriptStrict|x86.ActiveCfg = Release|Any CPU {3A6CA187-AD6F-438C-9E5B-B2771F75AF41}.ReleaseTypeScriptStrict|x86.Build.0 = Release|Any CPU - {F109D48B-A2FF-497D-8374-FEA60C5F2365}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F109D48B-A2FF-497D-8374-FEA60C5F2365}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F109D48B-A2FF-497D-8374-FEA60C5F2365}.Debug|x64.ActiveCfg = Debug|Any CPU - {F109D48B-A2FF-497D-8374-FEA60C5F2365}.Debug|x64.Build.0 = Debug|Any CPU - {F109D48B-A2FF-497D-8374-FEA60C5F2365}.Debug|x86.ActiveCfg = Debug|Any CPU - {F109D48B-A2FF-497D-8374-FEA60C5F2365}.Debug|x86.Build.0 = Debug|Any CPU - {F109D48B-A2FF-497D-8374-FEA60C5F2365}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F109D48B-A2FF-497D-8374-FEA60C5F2365}.Release|Any CPU.Build.0 = Release|Any CPU - {F109D48B-A2FF-497D-8374-FEA60C5F2365}.Release|x64.ActiveCfg = Release|Any CPU - {F109D48B-A2FF-497D-8374-FEA60C5F2365}.Release|x64.Build.0 = Release|Any CPU - {F109D48B-A2FF-497D-8374-FEA60C5F2365}.Release|x86.ActiveCfg = Release|Any CPU - {F109D48B-A2FF-497D-8374-FEA60C5F2365}.Release|x86.Build.0 = Release|Any CPU - {F109D48B-A2FF-497D-8374-FEA60C5F2365}.ReleaseTypeScriptStrict|Any CPU.ActiveCfg = Release|Any CPU - {F109D48B-A2FF-497D-8374-FEA60C5F2365}.ReleaseTypeScriptStrict|Any CPU.Build.0 = Release|Any CPU - {F109D48B-A2FF-497D-8374-FEA60C5F2365}.ReleaseTypeScriptStrict|x64.ActiveCfg = Release|Any CPU - {F109D48B-A2FF-497D-8374-FEA60C5F2365}.ReleaseTypeScriptStrict|x64.Build.0 = Release|Any CPU - {F109D48B-A2FF-497D-8374-FEA60C5F2365}.ReleaseTypeScriptStrict|x86.ActiveCfg = Release|Any CPU - {F109D48B-A2FF-497D-8374-FEA60C5F2365}.ReleaseTypeScriptStrict|x86.Build.0 = Release|Any CPU - {FC20849C-915D-411B-8CFB-915B7751D898}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FC20849C-915D-411B-8CFB-915B7751D898}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FC20849C-915D-411B-8CFB-915B7751D898}.Debug|x64.ActiveCfg = Debug|Any CPU - {FC20849C-915D-411B-8CFB-915B7751D898}.Debug|x64.Build.0 = Debug|Any CPU - {FC20849C-915D-411B-8CFB-915B7751D898}.Debug|x86.ActiveCfg = Debug|Any CPU - {FC20849C-915D-411B-8CFB-915B7751D898}.Debug|x86.Build.0 = Debug|Any CPU - {FC20849C-915D-411B-8CFB-915B7751D898}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FC20849C-915D-411B-8CFB-915B7751D898}.Release|Any CPU.Build.0 = Release|Any CPU - {FC20849C-915D-411B-8CFB-915B7751D898}.Release|x64.ActiveCfg = Release|Any CPU - {FC20849C-915D-411B-8CFB-915B7751D898}.Release|x64.Build.0 = Release|Any CPU - {FC20849C-915D-411B-8CFB-915B7751D898}.Release|x86.ActiveCfg = Release|Any CPU - {FC20849C-915D-411B-8CFB-915B7751D898}.Release|x86.Build.0 = Release|Any CPU - {FC20849C-915D-411B-8CFB-915B7751D898}.ReleaseTypeScriptStrict|Any CPU.ActiveCfg = Debug|Any CPU - {FC20849C-915D-411B-8CFB-915B7751D898}.ReleaseTypeScriptStrict|Any CPU.Build.0 = Debug|Any CPU - {FC20849C-915D-411B-8CFB-915B7751D898}.ReleaseTypeScriptStrict|x64.ActiveCfg = Debug|Any CPU - {FC20849C-915D-411B-8CFB-915B7751D898}.ReleaseTypeScriptStrict|x64.Build.0 = Debug|Any CPU - {FC20849C-915D-411B-8CFB-915B7751D898}.ReleaseTypeScriptStrict|x86.ActiveCfg = Debug|Any CPU - {FC20849C-915D-411B-8CFB-915B7751D898}.ReleaseTypeScriptStrict|x86.Build.0 = Debug|Any CPU {7C9814BB-5B98-43F1-9CD2-4C55CEB9DFBF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7C9814BB-5B98-43F1-9CD2-4C55CEB9DFBF}.Debug|Any CPU.Build.0 = Debug|Any CPU {7C9814BB-5B98-43F1-9CD2-4C55CEB9DFBF}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -648,7 +588,6 @@ Global {6AB4FD70-2CCF-4876-A193-B5FD6B32C39A} = {D8CC0D1C-8DAC-49FE-AA78-C028DC124DD5} {55672414-CC74-4943-B878-508EC4D486AD} = {D8CC0D1C-8DAC-49FE-AA78-C028DC124DD5} {C56AC38A-513B-40C6-AEB8-0146BB5B2888} = {D8CC0D1C-8DAC-49FE-AA78-C028DC124DD5} - {B024633F-AA96-4551-AB18-2EF9650425AF} = {A0338E8D-A4A3-4380-9FF7-1D0BDC260E31} {9829DFE2-7F49-40E3-B6A5-AEBB42D1DB33} = {D8CC0D1C-8DAC-49FE-AA78-C028DC124DD5} {C7923A8B-D0CE-4FD8-ADA0-7507D5F3F693} = {D8CC0D1C-8DAC-49FE-AA78-C028DC124DD5} {95B83E7B-1ADF-4185-AB36-3B17459B0128} = {D8CC0D1C-8DAC-49FE-AA78-C028DC124DD5} @@ -659,8 +598,6 @@ Global {DCAF8B88-E36F-48F8-AD0E-0F9B42E9FEB6} = {49A70E20-FF73-451D-BBE8-7680EDCF007B} {06B5C478-0ACC-4088-97B6-891C4F35EBBC} = {D8CC0D1C-8DAC-49FE-AA78-C028DC124DD5} {3A6CA187-AD6F-438C-9E5B-B2771F75AF41} = {D8CC0D1C-8DAC-49FE-AA78-C028DC124DD5} - {F109D48B-A2FF-497D-8374-FEA60C5F2365} = {A0338E8D-A4A3-4380-9FF7-1D0BDC260E31} - {FC20849C-915D-411B-8CFB-915B7751D898} = {A0338E8D-A4A3-4380-9FF7-1D0BDC260E31} {7C9814BB-5B98-43F1-9CD2-4C55CEB9DFBF} = {A0338E8D-A4A3-4380-9FF7-1D0BDC260E31} {FA78E42D-F49F-45E3-820E-331FB8E34195} = {A0338E8D-A4A3-4380-9FF7-1D0BDC260E31} EndGlobalSection diff --git a/src/NSwag.Npm/README.md b/src/NSwag.Npm/README.md index d12538194c..7110e9d726 100644 --- a/src/NSwag.Npm/README.md +++ b/src/NSwag.Npm/README.md @@ -39,18 +39,6 @@ Add the switch `/runtime:NetCore*` to the command to execute one of the .NET Cor To specify what .NET Core binaries to execute, either use (default) - nswag version /runtime:NetCore21 - -or - - nswag version /runtime:NetCore31 - -or - - nswag version /runtime:Net50 - -or - nswag version /runtime:Net60 ## Development diff --git a/src/NSwag.Npm/bin/nswag.js b/src/NSwag.Npm/bin/nswag.js index 90d727b77e..86f189e4ff 100644 --- a/src/NSwag.Npm/bin/nswag.js +++ b/src/NSwag.Npm/bin/nswag.js @@ -3,11 +3,6 @@ var defaultCoreVersion = "Net70"; var supportedCoreVersions = [ - { ver: '2.1', dir: "NetCore21", }, - { ver: '2.2', dir: "NetCore22", }, - { ver: '3.0', dir: "NetCore30", }, - { ver: '3.1', dir: "NetCore31", }, - { ver: '5.0', dir: "Net50", }, { ver: '6.0', dir: "Net60", }, { ver: '7.0', dir: "Net70", }, ]; @@ -20,9 +15,6 @@ var args = process.argv.splice(2, process.argv.length - 2).map(function (a) { re // Legacy support args = args.replace("--x86", "/runtime:WinX86"); args = args.replace("/runtime:x86", "/runtime:WinX86"); -args = args.replace("--core 2.1", "/runtime:NetCore21"); -args = args.replace("--core 3.1", "/runtime:NetCore31"); -args = args.replace("--core 5.0", "/runtime:Net50"); args = args.replace("--core 6.0", "/runtime:Net60"); args = args.replace("--core 7.0", "/runtime:Net70"); args = args.replace("--core", "/runtime:" + defaultCoreVersion); diff --git a/src/NSwag.Npm/package-lock.json b/src/NSwag.Npm/package-lock.json index c4f3636353..3f2eb7b09c 100644 --- a/src/NSwag.Npm/package-lock.json +++ b/src/NSwag.Npm/package-lock.json @@ -1,5 +1,19 @@ { "name": "nswag", - "version": "13.15.4", - "lockfileVersion": 1 + "version": "13.15.5", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "nswag", + "version": "13.15.5", + "license": "MIT", + "bin": { + "nswag": "bin/nswag.js" + }, + "engines": { + "npm": ">=3.10.8" + } + } + } } diff --git a/src/NSwag.Sample.Common/NSwag.Sample.Common.csproj b/src/NSwag.Sample.Common/NSwag.Sample.Common.csproj index 9eca547297..eb7e0662cf 100644 --- a/src/NSwag.Sample.Common/NSwag.Sample.Common.csproj +++ b/src/NSwag.Sample.Common/NSwag.Sample.Common.csproj @@ -1,7 +1,7 @@  - netstandard1.4 + netstandard2.0 \ No newline at end of file diff --git a/src/NSwag.Sample.NET50/Controllers/ValuesController.cs b/src/NSwag.Sample.NET50/Controllers/ValuesController.cs deleted file mode 100644 index 377079e037..0000000000 --- a/src/NSwag.Sample.NET50/Controllers/ValuesController.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using System.Collections.Generic; -using Microsoft.AspNetCore.Mvc; - -namespace NSwag.Sample.NET50.Controllers -{ - [Route("api/[controller]")] - [ApiController] - public class ValuesController : ControllerBase - { - public class Person - { - public string FirstName { get; set; } = ""; - - public string? MiddleName { get; set; } - - public string LastName { get; set; } = ""; - - public DateTime DayOfBirth { get; set; } - } - - public enum TestEnum - { - Foo, - Bar - } - - [HttpGet] - public ActionResult> Get() - { - return new Person[] { }; - } - - // GET api/values/5 - [HttpGet("{id}")] - public ActionResult Get(int id) - { - return TestEnum.Foo; - } - - // GET api/values/5 - [HttpGet("{id}/foo")] - public ActionResult GetFooBar(int id) - { - return "value"; - } - - // POST api/values - [HttpPost] - public void Post([FromBody] string value) - { - } - - // PUT api/values/5 - [HttpPut("{id}")] - public void Put(int id, [FromBody] string value) - { - } - - // DELETE api/values/5 - [HttpDelete("{id}")] - public void Delete(int id) - { - } - } -} diff --git a/src/NSwag.Sample.NET50/NSwag.Sample.NET50.csproj b/src/NSwag.Sample.NET50/NSwag.Sample.NET50.csproj deleted file mode 100644 index 69d950cd98..0000000000 --- a/src/NSwag.Sample.NET50/NSwag.Sample.NET50.csproj +++ /dev/null @@ -1,13 +0,0 @@ - - - net5.0 - enable - 8.0 - - - - - - - - diff --git a/src/NSwag.Sample.NET50/Program.cs b/src/NSwag.Sample.NET50/Program.cs deleted file mode 100644 index 6e50522ef2..0000000000 --- a/src/NSwag.Sample.NET50/Program.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.Hosting; - -namespace NSwag.Sample.NET50 -{ - public class Program - { - public static void Main(string[] args) - { - CreateHostBuilder(args).Build().Run(); - } - - public static IHostBuilder CreateHostBuilder(string[] args) => - Host.CreateDefaultBuilder(args) - .ConfigureWebHostDefaults(webBuilder => - { - webBuilder.UseStartup(); - }); - } -} diff --git a/src/NSwag.Sample.NET50/Properties/launchSettings.json b/src/NSwag.Sample.NET50/Properties/launchSettings.json deleted file mode 100644 index 50ee08064c..0000000000 --- a/src/NSwag.Sample.NET50/Properties/launchSettings.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:1284/", - "sslPort": 44390 - } - }, - "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "NSwag.Sample.NET50": { - "commandName": "Project", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - }, - "applicationUrl": "http://localhost:5000;https://localhost:5001" - } - } -} \ No newline at end of file diff --git a/src/NSwag.Sample.NET50/Startup.cs b/src/NSwag.Sample.NET50/Startup.cs deleted file mode 100644 index 2487a295b1..0000000000 --- a/src/NSwag.Sample.NET50/Startup.cs +++ /dev/null @@ -1,65 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; -using NJsonSchema.Generation; -using System.Text.Json.Serialization; - -namespace NSwag.Sample.NET50 -{ - public class Startup - { - public Startup(IConfiguration configuration) - { - Configuration = configuration; - } - - public IConfiguration Configuration { get; } - - public void ConfigureServices(IServiceCollection services) - { - services.AddMvc(); - - services - .AddControllers() - .AddJsonOptions(options => - { - options.JsonSerializerOptions.DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull; - options.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter()); - }); - - services.AddOpenApiDocument(document => - { - document.Description = "Hello world!"; - document.DefaultReferenceTypeNullHandling = ReferenceTypeNullHandling.NotNull; - }); - } - - public void Configure(IApplicationBuilder app, IWebHostEnvironment env) - { - if (env.IsDevelopment()) - { - app.UseDeveloperExceptionPage(); - } - - app.UseHttpsRedirection(); - app.UseRouting(); - app.UseAuthorization(); - app.UseEndpoints(endpoints => - { - endpoints.MapControllers(); - }); - - app.UseOpenApi(p => p.Path = "/swagger/{documentName}/swagger.yaml"); - app.UseSwaggerUi3(p => p.DocumentPath = "/swagger/{documentName}/swagger.yaml"); - //app.UseApimundo(); - app.UseApimundo(settings => - { - //settings.CompareTo = "a:a:27:25:15:latest"; - settings.DocumentPath = "/swagger/v1/swagger.yaml"; - settings.ApimundoUrl = "https://localhost:5001"; - }); - } - } -} diff --git a/src/NSwag.Sample.NET50/appsettings.Development.json b/src/NSwag.Sample.NET50/appsettings.Development.json deleted file mode 100644 index e203e9407e..0000000000 --- a/src/NSwag.Sample.NET50/appsettings.Development.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Debug", - "System": "Information", - "Microsoft": "Information" - } - } -} diff --git a/src/NSwag.Sample.NET50/appsettings.json b/src/NSwag.Sample.NET50/appsettings.json deleted file mode 100644 index 7cb5ac8193..0000000000 --- a/src/NSwag.Sample.NET50/appsettings.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Warning", - "Microsoft.Hosting.Lifetime": "Information" - } - }, - "AllowedHosts": "*" -} diff --git a/src/NSwag.Sample.NET50/nswag.json b/src/NSwag.Sample.NET50/nswag.json deleted file mode 100644 index 4bda4cf1ce..0000000000 --- a/src/NSwag.Sample.NET50/nswag.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "runtime": "Net50", - "defaultVariables": null, - "documentGenerator": { - "aspNetCoreToOpenApi": { - "project": "NSwag.Sample.NET50.csproj", - "msBuildProjectExtensionsPath": null, - "configuration": null, - "runtime": null, - "targetFramework": null, - "noBuild": false, - "verbose": true, - "workingDirectory": null, - "requireParametersWithoutDefault": false, - "apiGroupNames": null, - "defaultPropertyNameHandling": "Default", - "defaultReferenceTypeNullHandling": "Null", - "defaultDictionaryValueReferenceTypeNullHandling": "NotNull", - "defaultResponseReferenceTypeNullHandling": "NotNull", - "defaultEnumHandling": "Integer", - "flattenInheritanceHierarchy": false, - "generateKnownTypes": true, - "generateEnumMappingDescription": false, - "generateXmlObjects": false, - "generateAbstractProperties": false, - "generateAbstractSchemas": true, - "ignoreObsoleteProperties": false, - "allowReferencesWithProperties": false, - "excludedTypeNames": [], - "serviceHost": null, - "serviceBasePath": null, - "serviceSchemes": [], - "infoTitle": "My Title", - "infoDescription": null, - "infoVersion": "1.0.0", - "documentTemplate": null, - "documentProcessorTypes": [], - "operationProcessorTypes": [], - "typeNameGeneratorType": null, - "schemaNameGeneratorType": null, - "contractResolverType": null, - "serializerSettingsType": null, - "useDocumentProvider": true, - "documentName": "v1", - "aspNetCoreEnvironment": null, - "createWebHostBuilderMethod": null, - "startupType": null, - "allowNullableBodyParameters": true, - "output": "openapi.json", - "outputType": "Swagger2", - "assemblyPaths": [], - "assemblyConfig": null, - "referencePaths": [], - "useNuGetCache": false - } - }, - "codeGenerators": {} -} \ No newline at end of file diff --git a/src/NSwag.Sample.NET50/openapi.json b/src/NSwag.Sample.NET50/openapi.json deleted file mode 100644 index b056765f37..0000000000 --- a/src/NSwag.Sample.NET50/openapi.json +++ /dev/null @@ -1,215 +0,0 @@ -{ - "x-generator": "NSwag v13.15.5.0 (NJsonSchema v10.6.6.0 (Newtonsoft.Json v12.0.0.0))", - "openapi": "3.0.0", - "info": { - "title": "My Title", - "description": "Hello world!", - "version": "1.0.0" - }, - "paths": { - "/api/Values": { - "get": { - "tags": [ - "Values" - ], - "operationId": "Values_GetAll", - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Person" - } - } - } - } - } - } - }, - "post": { - "tags": [ - "Values" - ], - "operationId": "Values_Post", - "requestBody": { - "x-name": "value", - "content": { - "application/json": { - "schema": { - "type": "string" - } - } - }, - "required": true, - "x-position": 1 - }, - "responses": { - "200": { - "description": "" - } - } - } - }, - "/api/Values/{id}": { - "get": { - "tags": [ - "Values" - ], - "operationId": "Values_Get", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - }, - "x-position": 1 - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/TestEnum" - } - } - } - } - } - }, - "put": { - "tags": [ - "Values" - ], - "operationId": "Values_Put", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - }, - "x-position": 1 - } - ], - "requestBody": { - "x-name": "value", - "content": { - "application/json": { - "schema": { - "type": "string" - } - } - }, - "required": true, - "x-position": 2 - }, - "responses": { - "200": { - "description": "" - } - } - }, - "delete": { - "tags": [ - "Values" - ], - "operationId": "Values_Delete", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - }, - "x-position": 1 - } - ], - "responses": { - "200": { - "description": "" - } - } - } - }, - "/api/Values/{id}/foo": { - "get": { - "tags": [ - "Values" - ], - "operationId": "Values_GetFooBar", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - }, - "x-position": 1 - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "type": "string" - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Person": { - "type": "object", - "additionalProperties": false, - "properties": { - "firstName": { - "type": "string" - }, - "middleName": { - "type": "string", - "nullable": true - }, - "lastName": { - "type": "string" - }, - "dayOfBirth": { - "type": "string", - "format": "date-time" - } - } - }, - "TestEnum": { - "type": "string", - "description": "", - "x-enumNames": [ - "Foo", - "Bar" - ], - "enum": [ - "Foo", - "Bar" - ] - } - } - } -} \ No newline at end of file diff --git a/src/NSwag.Sample.NETCore20.Part/NSwag.Sample.NETCore20.Part.csproj b/src/NSwag.Sample.NETCore20.Part/NSwag.Sample.NETCore20.Part.csproj deleted file mode 100644 index 2a377ca6d6..0000000000 --- a/src/NSwag.Sample.NETCore20.Part/NSwag.Sample.NETCore20.Part.csproj +++ /dev/null @@ -1,8 +0,0 @@ - - - netcoreapp2.0 - - - - - diff --git a/src/NSwag.Sample.NETCore20.Part/SampleController.cs b/src/NSwag.Sample.NETCore20.Part/SampleController.cs deleted file mode 100644 index e399930843..0000000000 --- a/src/NSwag.Sample.NETCore20.Part/SampleController.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Microsoft.AspNetCore.Mvc; - -namespace NSwag.Sample.NETCore20.Part -{ - [Route("/sample")] - public class SampleController : Controller - { - [HttpPost] - public string GetSample() - { - return null; - } - } -} diff --git a/src/NSwag.Sample.NETCore20/NSwag.Sample.NETCore20.csproj b/src/NSwag.Sample.NETCore20/NSwag.Sample.NETCore20.csproj deleted file mode 100644 index d648e88b31..0000000000 --- a/src/NSwag.Sample.NETCore20/NSwag.Sample.NETCore20.csproj +++ /dev/null @@ -1,21 +0,0 @@ - - - netcoreapp2.0 - false - - - - %(RecursiveDir)\%(FileName)%(Extension) - - - - - - - - - - - - - diff --git a/src/NSwag.Sample.NETCore20/Output/swagger_new_v2.json b/src/NSwag.Sample.NETCore20/Output/swagger_new_v2.json deleted file mode 100644 index b6f2aaa55e..0000000000 --- a/src/NSwag.Sample.NETCore20/Output/swagger_new_v2.json +++ /dev/null @@ -1,601 +0,0 @@ -{ - "x-generator": "NSwag v11.18.3.0 (NJsonSchema v9.10.67.0 (Newtonsoft.Json v10.0.0.0))", - "swagger": "2.0", - "info": { - "title": "My Title", - "version": "1.0.0" - }, - "host": "localhost:65384", - "schemes": [ - "http" - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json", - "text/plain", - "text/json" - ], - "paths": { - "/pet": { - "post": { - "tags": [ - "Pet" - ], - "operationId": "Pet_AddPet", - "consumes": [ - "application/json" - ], - "parameters": [ - { - "name": "pet", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/Pet" - }, - "x-nullable": true - } - ], - "responses": { - "400": { - "x-nullable": true, - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - } - } - } - }, - "put": { - "tags": [ - "Pet" - ], - "operationId": "Pet_EditPet", - "consumes": [ - "application/json" - ], - "parameters": [ - { - "name": "pet", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/Pet" - }, - "x-nullable": true - } - ], - "responses": { - "400": { - "x-nullable": true, - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - } - } - } - } - }, - "/pet/findByStatus": { - "get": { - "tags": [ - "Pet" - ], - "operationId": "Pet_FindByStatus", - "parameters": [ - { - "type": "array", - "name": "status", - "in": "query", - "required": true, - "collectionFormat": "multi", - "x-nullable": true, - "items": { - "type": "string" - } - } - ], - "responses": { - "200": { - "x-nullable": true, - "description": "", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/Pet" - } - } - }, - "400": { - "x-nullable": true, - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - } - } - } - } - }, - "/pet/findByCategory": { - "get": { - "tags": [ - "Pet" - ], - "operationId": "Pet_FindByCategory", - "parameters": [ - { - "type": "string", - "name": "category", - "in": "query", - "required": true, - "x-nullable": true - } - ], - "responses": { - "200": { - "x-nullable": true, - "description": "", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/Pet" - } - } - }, - "400": { - "x-nullable": true, - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - } - } - } - } - }, - "/pet/{petId}": { - "get": { - "tags": [ - "Pet" - ], - "operationId": "Pet_FindById", - "parameters": [ - { - "type": "integer", - "name": "petId", - "in": "path", - "required": true, - "format": "int32", - "x-nullable": false - } - ], - "responses": { - "200": { - "x-nullable": true, - "description": "", - "schema": { - "$ref": "#/definitions/Pet" - } - }, - "400": { - "x-nullable": true, - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - } - }, - "404": { - "description": "" - } - } - }, - "post": { - "tags": [ - "Pet" - ], - "operationId": "Pet_EditPetWithFormData", - "parameters": [ - { - "type": "integer", - "name": "petId", - "in": "path", - "required": true, - "format": "int32", - "x-nullable": false - }, - { - "type": "integer", - "name": "Id", - "in": "formData", - "required": true, - "format": "int32", - "x-nullable": false - }, - { - "type": "integer", - "name": "Age", - "in": "formData", - "required": true, - "format": "int32", - "x-nullable": false - }, - { - "type": "integer", - "name": "Category.Id", - "in": "formData", - "required": true, - "format": "int32", - "x-nullable": false - }, - { - "type": "string", - "name": "Category.Name", - "in": "formData", - "required": true, - "x-nullable": true - }, - { - "type": "boolean", - "name": "HasVaccinations", - "in": "formData", - "required": true, - "x-nullable": false - }, - { - "type": "string", - "name": "Name", - "in": "formData", - "required": true, - "x-nullable": true - }, - { - "type": "array", - "name": "Images", - "in": "formData", - "required": true, - "collectionFormat": "multi", - "x-nullable": true, - "items": { - "$ref": "#/definitions/Image" - } - }, - { - "type": "array", - "name": "Tags", - "in": "formData", - "required": true, - "collectionFormat": "multi", - "x-nullable": true, - "items": { - "$ref": "#/definitions/Tag" - } - }, - { - "type": "string", - "name": "Status", - "in": "formData", - "required": true, - "x-nullable": true - } - ], - "responses": { - "400": { - "x-nullable": true, - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - } - }, - "404": { - "description": "" - } - } - }, - "delete": { - "tags": [ - "Pet" - ], - "operationId": "Pet_DeletePet", - "parameters": [ - { - "type": "integer", - "name": "petId", - "in": "path", - "required": true, - "format": "int32", - "x-nullable": false - } - ], - "responses": { - "400": { - "x-nullable": true, - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - } - }, - "404": { - "description": "" - } - } - } - }, - "/pet/{petId}/uploadImage": { - "post": { - "tags": [ - "Pet" - ], - "operationId": "Pet_UploadImage", - "consumes": [ - "multipart/form-data" - ], - "parameters": [ - { - "type": "integer", - "name": "petId", - "in": "path", - "required": true, - "format": "int32", - "x-nullable": false - }, - { - "type": "file", - "name": "file", - "in": "formData", - "required": true, - "x-nullable": true - } - ], - "responses": { - "200": { - "x-nullable": true, - "description": "", - "schema": { - "$ref": "#/definitions/ApiResponse" - } - }, - "400": { - "x-nullable": true, - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - } - }, - "404": { - "description": "" - } - } - } - }, - "/pet/RequiredAndOptional": { - "post": { - "tags": [ - "Pet" - ], - "operationId": "Pet_RequiredAndOptional", - "parameters": [ - { - "type": "integer", - "name": "int_RequiredAndNotNullable", - "in": "query", - "required": true, - "format": "int32", - "x-nullable": false - }, - { - "type": "integer", - "name": "int_RequiredAndNullable", - "in": "query", - "required": true, - "format": "int32", - "x-nullable": true - }, - { - "type": "string", - "name": "string_RequiredAndNullable", - "in": "query", - "required": true, - "x-nullable": true - }, - { - "type": "string", - "name": "string_RequiredAndNotNullable", - "in": "query", - "required": true, - "x-nullable": false - }, - { - "type": "number", - "name": "decimalWithDefault_NotRequiredAndNotNullable", - "in": "query", - "format": "decimal", - "default": 1.0, - "x-nullable": false - }, - { - "type": "number", - "name": "decimalWithDefault_NotRequiredAndNullable", - "in": "query", - "format": "decimal", - "default": 1.0, - "x-nullable": true - }, - { - "type": "string", - "name": "stringWithDefault_NotRequiredAndNullable", - "in": "query", - "default": "foo", - "x-nullable": true - }, - { - "type": "string", - "name": "stringWithDefault_NotRequiredAndNotNullable", - "in": "query", - "default": "foo", - "x-nullable": false - } - ], - "responses": { - "200": { - "description": "" - } - } - } - }, - "/sample": { - "post": { - "tags": [ - "Sample" - ], - "operationId": "Sample_GetSample", - "responses": { - "200": { - "x-nullable": true, - "description": "", - "schema": { - "type": "string" - } - } - } - } - } - }, - "definitions": { - "Pet": { - "type": "object", - "additionalProperties": false, - "required": [ - "id", - "age", - "hasVaccinations", - "name", - "status" - ], - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "age": { - "type": "integer", - "format": "int32", - "maximum": 150.0, - "minimum": 0.0 - }, - "category": { - "$ref": "#/definitions/Category" - }, - "hasVaccinations": { - "type": "boolean" - }, - "name": { - "type": "string", - "maxLength": 50, - "minLength": 2 - }, - "images": { - "type": "array", - "items": { - "$ref": "#/definitions/Image" - } - }, - "tags": { - "type": "array", - "items": { - "$ref": "#/definitions/Tag" - } - }, - "status": { - "type": "string", - "minLength": 1 - } - } - }, - "Category": { - "type": "object", - "additionalProperties": false, - "required": [ - "id" - ], - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "name": { - "type": "string" - } - } - }, - "Image": { - "type": "object", - "additionalProperties": false, - "required": [ - "id" - ], - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "url": { - "type": "string" - } - } - }, - "Tag": { - "type": "object", - "additionalProperties": false, - "required": [ - "id" - ], - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "name": { - "type": "string" - } - } - }, - "SerializableError": { - "type": "object", - "additionalProperties": false, - "allOf": [ - { - "type": "object", - "additionalProperties": {} - } - ] - }, - "ApiResponse": { - "type": "object", - "additionalProperties": false, - "required": [ - "code" - ], - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "message": { - "type": "string" - }, - "type": { - "type": "string" - } - } - } - }, - "securityDefinitions": { - "TEST_HEADER": { - "type": "apiKey", - "description": "TEST_HEADER", - "name": "TEST_HEADER", - "in": "header" - } - } -} \ No newline at end of file diff --git a/src/NSwag.Sample.NETCore20/Output/swagger_new_v3.json b/src/NSwag.Sample.NETCore20/Output/swagger_new_v3.json deleted file mode 100644 index 844554e4b2..0000000000 --- a/src/NSwag.Sample.NETCore20/Output/swagger_new_v3.json +++ /dev/null @@ -1,728 +0,0 @@ -{ - "x-generator": "NSwag v11.18.3.0 (NJsonSchema v9.10.67.0 (Newtonsoft.Json v10.0.0.0))", - "openapi": "3.0", - "info": { - "title": "My Title", - "version": "1.0.0" - }, - "consumes": [ - "application/json" - ], - "produces": [ - "application/json", - "text/plain", - "text/json" - ], - "servers": [ - { - "url": "http://localhost:65384" - } - ], - "paths": { - "/pet": { - "post": { - "tags": [ - "Pet" - ], - "operationId": "Pet_AddPet", - "requestBody": { - "x-name": "pet", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Pet" - } - } - }, - "required": true - }, - "responses": { - "400": { - "x-nullable": true, - "description": "", - "content": { - "application/json": { - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/SerializableError" - } - ] - } - } - } - } - } - }, - "put": { - "tags": [ - "Pet" - ], - "operationId": "Pet_EditPet", - "requestBody": { - "x-name": "pet", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Pet" - } - } - }, - "required": true - }, - "responses": { - "400": { - "x-nullable": true, - "description": "", - "content": { - "application/json": { - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/SerializableError" - } - ] - } - } - } - } - } - } - }, - "/pet/findByStatus": { - "get": { - "tags": [ - "Pet" - ], - "operationId": "Pet_FindByStatus", - "parameters": [ - { - "name": "status", - "in": "query", - "required": true, - "schema": { - "type": "array", - "items": { - "type": "string" - } - }, - "collectionFormat": "multi", - "nullable": true - } - ], - "responses": { - "200": { - "x-nullable": true, - "description": "", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Pet" - } - } - } - } - }, - "400": { - "x-nullable": true, - "description": "", - "content": { - "application/json": { - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/SerializableError" - } - ] - } - } - } - } - } - } - }, - "/pet/findByCategory": { - "get": { - "tags": [ - "Pet" - ], - "operationId": "Pet_FindByCategory", - "parameters": [ - { - "name": "category", - "in": "query", - "required": true, - "schema": { - "type": "string" - }, - "nullable": true - } - ], - "responses": { - "200": { - "x-nullable": true, - "description": "", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Pet" - } - } - } - } - }, - "400": { - "x-nullable": true, - "description": "", - "content": { - "application/json": { - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/SerializableError" - } - ] - } - } - } - } - } - } - }, - "/pet/{petId}": { - "get": { - "tags": [ - "Pet" - ], - "operationId": "Pet_FindById", - "parameters": [ - { - "name": "petId", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - }, - "nullable": false - } - ], - "responses": { - "200": { - "x-nullable": true, - "description": "", - "content": { - "application/json": { - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/Pet" - } - ] - } - } - } - }, - "400": { - "x-nullable": true, - "description": "", - "content": { - "application/json": { - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/SerializableError" - } - ] - } - } - } - }, - "404": { - "description": "" - } - } - }, - "post": { - "tags": [ - "Pet" - ], - "operationId": "Pet_EditPetWithFormData", - "parameters": [ - { - "name": "petId", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - }, - "nullable": false - }, - { - "name": "Id", - "in": "formData", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - }, - "nullable": false - }, - { - "name": "Age", - "in": "formData", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - }, - "nullable": false - }, - { - "name": "Category.Id", - "in": "formData", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - }, - "nullable": false - }, - { - "name": "Category.Name", - "in": "formData", - "required": true, - "schema": { - "type": "string" - }, - "nullable": true - }, - { - "name": "HasVaccinations", - "in": "formData", - "required": true, - "schema": { - "type": "boolean" - }, - "nullable": false - }, - { - "name": "Name", - "in": "formData", - "required": true, - "schema": { - "type": "string" - }, - "nullable": true - }, - { - "name": "Images", - "in": "formData", - "required": true, - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Image" - } - }, - "collectionFormat": "multi", - "nullable": true - }, - { - "name": "Tags", - "in": "formData", - "required": true, - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Tag" - } - }, - "collectionFormat": "multi", - "nullable": true - }, - { - "name": "Status", - "in": "formData", - "required": true, - "schema": { - "type": "string" - }, - "nullable": true - } - ], - "responses": { - "400": { - "x-nullable": true, - "description": "", - "content": { - "application/json": { - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/SerializableError" - } - ] - } - } - } - }, - "404": { - "description": "" - } - } - }, - "delete": { - "tags": [ - "Pet" - ], - "operationId": "Pet_DeletePet", - "parameters": [ - { - "name": "petId", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - }, - "nullable": false - } - ], - "responses": { - "400": { - "x-nullable": true, - "description": "", - "content": { - "application/json": { - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/SerializableError" - } - ] - } - } - } - }, - "404": { - "description": "" - } - } - } - }, - "/pet/{petId}/uploadImage": { - "post": { - "tags": [ - "Pet" - ], - "operationId": "Pet_UploadImage", - "parameters": [ - { - "name": "petId", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - }, - "nullable": false - }, - { - "type": "file", - "name": "file", - "in": "formData", - "required": true, - "schema": { - "type": "file" - }, - "nullable": true - } - ], - "responses": { - "200": { - "x-nullable": true, - "description": "", - "content": { - "application/json": { - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/ApiResponse" - } - ] - } - } - } - }, - "400": { - "x-nullable": true, - "description": "", - "content": { - "application/json": { - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/SerializableError" - } - ] - } - } - } - }, - "404": { - "description": "" - } - } - } - }, - "/pet/RequiredAndOptional": { - "post": { - "tags": [ - "Pet" - ], - "operationId": "Pet_RequiredAndOptional", - "parameters": [ - { - "name": "int_RequiredAndNotNullable", - "in": "query", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - }, - "nullable": false - }, - { - "name": "int_RequiredAndNullable", - "in": "query", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - }, - "nullable": true - }, - { - "name": "string_RequiredAndNullable", - "in": "query", - "required": true, - "schema": { - "type": "string" - }, - "nullable": true - }, - { - "name": "string_RequiredAndNotNullable", - "in": "query", - "required": true, - "schema": { - "type": "string" - }, - "nullable": false - }, - { - "name": "decimalWithDefault_NotRequiredAndNotNullable", - "in": "query", - "schema": { - "type": "number", - "format": "decimal" - }, - "default": 1.0, - "nullable": false - }, - { - "name": "decimalWithDefault_NotRequiredAndNullable", - "in": "query", - "schema": { - "type": "number", - "format": "decimal" - }, - "default": 1.0, - "nullable": true - }, - { - "name": "stringWithDefault_NotRequiredAndNullable", - "in": "query", - "schema": { - "type": "string" - }, - "default": "foo", - "nullable": true - }, - { - "name": "stringWithDefault_NotRequiredAndNotNullable", - "in": "query", - "schema": { - "type": "string" - }, - "default": "foo", - "nullable": false - } - ], - "responses": { - "200": { - "description": "" - } - } - } - }, - "/sample": { - "post": { - "tags": [ - "Sample" - ], - "operationId": "Sample_GetSample", - "responses": { - "200": { - "x-nullable": true, - "description": "", - "content": { - "application/json": { - "schema": { - "type": "string" - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "type": "object", - "additionalProperties": false, - "required": [ - "name", - "status" - ], - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "age": { - "type": "integer", - "format": "int32", - "maximum": 150.0, - "minimum": 0.0 - }, - "category": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/Category" - } - ] - }, - "hasVaccinations": { - "type": "boolean" - }, - "name": { - "type": "string", - "maxLength": 50, - "minLength": 2 - }, - "images": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Image" - } - }, - "tags": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Tag" - } - }, - "status": { - "type": "string", - "minLength": 1 - } - } - }, - "Category": { - "type": "object", - "additionalProperties": false, - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "name": { - "type": "string" - } - } - }, - "Image": { - "type": "object", - "additionalProperties": false, - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "url": { - "type": "string" - } - } - }, - "Tag": { - "type": "object", - "additionalProperties": false, - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "name": { - "type": "string" - } - } - }, - "SerializableError": { - "type": "object", - "additionalProperties": false, - "allOf": [ - { - "type": "object", - "additionalProperties": {} - } - ] - }, - "ApiResponse": { - "type": "object", - "additionalProperties": false, - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "message": { - "type": "string" - }, - "type": { - "type": "string" - } - } - } - } - } -} \ No newline at end of file diff --git a/src/NSwag.Sample.NETCore20/Output/swagger_old_v2.json b/src/NSwag.Sample.NETCore20/Output/swagger_old_v2.json deleted file mode 100644 index 0c60237713..0000000000 --- a/src/NSwag.Sample.NETCore20/Output/swagger_old_v2.json +++ /dev/null @@ -1,501 +0,0 @@ -{ - "x-generator": "NSwag v11.18.3.0 (NJsonSchema v9.10.67.0 (Newtonsoft.Json v10.0.0.0))", - "swagger": "2.0", - "info": { - "title": "My Title", - "version": "1.0.0" - }, - "host": "localhost:65384", - "schemes": [ - "http" - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "paths": { - "/pet": { - "post": { - "tags": [ - "Pet" - ], - "operationId": "Pet_AddPet", - "parameters": [ - { - "name": "pet", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/Pet" - }, - "x-nullable": true - } - ], - "responses": { - "400": { - "x-nullable": true, - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - } - } - } - }, - "put": { - "tags": [ - "Pet" - ], - "operationId": "Pet_EditPet", - "parameters": [ - { - "name": "pet", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/Pet" - }, - "x-nullable": true - } - ], - "responses": { - "400": { - "x-nullable": true, - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - } - } - } - } - }, - "/pet/findByStatus": { - "get": { - "tags": [ - "Pet" - ], - "operationId": "Pet_FindByStatus", - "parameters": [ - { - "type": "array", - "name": "status", - "in": "query", - "collectionFormat": "multi", - "x-nullable": true, - "items": { - "type": "string" - } - } - ], - "responses": { - "200": { - "x-nullable": true, - "description": "", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/Pet" - } - } - }, - "400": { - "x-nullable": true, - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - } - } - } - } - }, - "/pet/findByCategory": { - "get": { - "tags": [ - "Pet" - ], - "operationId": "Pet_FindByCategory", - "parameters": [ - { - "type": "string", - "name": "category", - "in": "query", - "required": true, - "x-nullable": true - } - ], - "responses": { - "200": { - "x-nullable": true, - "description": "", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/Pet" - } - } - }, - "400": { - "x-nullable": true, - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - } - } - } - } - }, - "/pet/{petId}": { - "get": { - "tags": [ - "Pet" - ], - "operationId": "Pet_FindById", - "parameters": [ - { - "type": "integer", - "name": "petId", - "in": "path", - "required": true, - "format": "int32", - "x-nullable": false - } - ], - "responses": { - "200": { - "x-nullable": true, - "description": "", - "schema": { - "$ref": "#/definitions/Pet" - } - }, - "400": { - "x-nullable": true, - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - } - }, - "404": { - "description": "" - } - } - }, - "post": { - "tags": [ - "Pet" - ], - "operationId": "Pet_EditPetWithFormData", - "parameters": [ - { - "type": "integer", - "name": "petId", - "in": "path", - "required": true, - "format": "int32", - "x-nullable": false - }, - { - "type": "object", - "name": "pet", - "in": "formData", - "x-schema": { - "$ref": "#/definitions/Pet" - }, - "x-nullable": true - } - ], - "responses": { - "400": { - "x-nullable": true, - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - } - }, - "404": { - "description": "" - } - } - }, - "delete": { - "tags": [ - "Pet" - ], - "operationId": "Pet_DeletePet", - "parameters": [ - { - "type": "integer", - "name": "petId", - "in": "path", - "required": true, - "format": "int32", - "x-nullable": false - } - ], - "responses": { - "400": { - "x-nullable": true, - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - } - }, - "404": { - "description": "" - } - } - } - }, - "/pet/{petId}/uploadImage": { - "post": { - "tags": [ - "Pet" - ], - "operationId": "Pet_UploadImage", - "consumes": [ - "multipart/form-data" - ], - "parameters": [ - { - "type": "integer", - "name": "petId", - "in": "path", - "required": true, - "format": "int32", - "x-nullable": false - }, - { - "type": "file", - "name": "file", - "in": "formData", - "x-nullable": true - } - ], - "responses": { - "200": { - "x-nullable": true, - "description": "", - "schema": { - "$ref": "#/definitions/ApiResponse" - } - }, - "400": { - "x-nullable": true, - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - } - }, - "404": { - "description": "" - } - } - } - }, - "/pet/RequiredAndOptional": { - "post": { - "tags": [ - "Pet" - ], - "operationId": "Pet_RequiredAndOptional", - "parameters": [ - { - "type": "integer", - "name": "int_RequiredAndNotNullable", - "in": "query", - "required": true, - "format": "int32", - "x-nullable": false - }, - { - "type": "integer", - "name": "int_RequiredAndNullable", - "in": "query", - "required": true, - "format": "int32", - "x-nullable": true - }, - { - "type": "string", - "name": "string_RequiredAndNullable", - "in": "query", - "required": true, - "x-nullable": true - }, - { - "type": "string", - "name": "string_RequiredAndNotNullable", - "in": "query", - "required": true, - "x-nullable": false - }, - { - "type": "number", - "name": "decimalWithDefault_NotRequiredAndNotNullable", - "in": "query", - "format": "decimal", - "default": 1.0, - "x-nullable": false - }, - { - "type": "number", - "name": "decimalWithDefault_NotRequiredAndNullable", - "in": "query", - "format": "decimal", - "default": 1.0, - "x-nullable": true - }, - { - "type": "string", - "name": "stringWithDefault_NotRequiredAndNullable", - "in": "query", - "default": "foo", - "x-nullable": true - }, - { - "type": "string", - "name": "stringWithDefault_NotRequiredAndNotNullable", - "in": "query", - "default": "foo", - "x-nullable": false - } - ], - "responses": { - "200": { - "description": "" - } - } - } - } - }, - "definitions": { - "Pet": { - "type": "object", - "additionalProperties": false, - "required": [ - "id", - "age", - "hasVaccinations", - "name", - "status" - ], - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "age": { - "type": "integer", - "format": "int32", - "maximum": 150.0, - "minimum": 0.0 - }, - "category": { - "$ref": "#/definitions/Category" - }, - "hasVaccinations": { - "type": "boolean" - }, - "name": { - "type": "string", - "maxLength": 50, - "minLength": 2 - }, - "images": { - "type": "array", - "items": { - "$ref": "#/definitions/Image" - } - }, - "tags": { - "type": "array", - "items": { - "$ref": "#/definitions/Tag" - } - }, - "status": { - "type": "string", - "minLength": 1 - } - } - }, - "Category": { - "type": "object", - "additionalProperties": false, - "required": [ - "id" - ], - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "name": { - "type": "string" - } - } - }, - "Image": { - "type": "object", - "additionalProperties": false, - "required": [ - "id" - ], - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "url": { - "type": "string" - } - } - }, - "Tag": { - "type": "object", - "additionalProperties": false, - "required": [ - "id" - ], - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "name": { - "type": "string" - } - } - }, - "SerializableError": { - "type": "object", - "additionalProperties": false, - "allOf": [ - { - "type": "object", - "additionalProperties": {} - } - ] - }, - "ApiResponse": { - "type": "object", - "additionalProperties": false, - "required": [ - "code" - ], - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "message": { - "type": "string" - }, - "type": { - "type": "string" - } - } - } - } -} \ No newline at end of file diff --git a/src/NSwag.Sample.NETCore20/Output/swagger_old_v3.json b/src/NSwag.Sample.NETCore20/Output/swagger_old_v3.json deleted file mode 100644 index 7d3d375314..0000000000 --- a/src/NSwag.Sample.NETCore20/Output/swagger_old_v3.json +++ /dev/null @@ -1,619 +0,0 @@ -{ - "x-generator": "NSwag v11.18.3.0 (NJsonSchema v9.10.67.0 (Newtonsoft.Json v10.0.0.0))", - "openapi": "3.0", - "info": { - "title": "My Title", - "version": "1.0.0" - }, - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "servers": [ - { - "url": "http://localhost:65384" - } - ], - "paths": { - "/pet": { - "post": { - "tags": [ - "Pet" - ], - "operationId": "Pet_AddPet", - "requestBody": { - "x-name": "pet", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Pet" - } - } - }, - "required": true - }, - "responses": { - "400": { - "x-nullable": true, - "description": "", - "content": { - "application/json": { - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/SerializableError" - } - ] - } - } - } - } - } - }, - "put": { - "tags": [ - "Pet" - ], - "operationId": "Pet_EditPet", - "requestBody": { - "x-name": "pet", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Pet" - } - } - }, - "required": true - }, - "responses": { - "400": { - "x-nullable": true, - "description": "", - "content": { - "application/json": { - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/SerializableError" - } - ] - } - } - } - } - } - } - }, - "/pet/findByStatus": { - "get": { - "tags": [ - "Pet" - ], - "operationId": "Pet_FindByStatus", - "parameters": [ - { - "name": "status", - "in": "query", - "schema": { - "type": "array", - "items": { - "type": "string" - } - }, - "collectionFormat": "multi", - "nullable": true - } - ], - "responses": { - "200": { - "x-nullable": true, - "description": "", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Pet" - } - } - } - } - }, - "400": { - "x-nullable": true, - "description": "", - "content": { - "application/json": { - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/SerializableError" - } - ] - } - } - } - } - } - } - }, - "/pet/findByCategory": { - "get": { - "tags": [ - "Pet" - ], - "operationId": "Pet_FindByCategory", - "parameters": [ - { - "name": "category", - "in": "query", - "required": true, - "schema": { - "type": "string" - }, - "nullable": true - } - ], - "responses": { - "200": { - "x-nullable": true, - "description": "", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Pet" - } - } - } - } - }, - "400": { - "x-nullable": true, - "description": "", - "content": { - "application/json": { - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/SerializableError" - } - ] - } - } - } - } - } - } - }, - "/pet/{petId}": { - "get": { - "tags": [ - "Pet" - ], - "operationId": "Pet_FindById", - "parameters": [ - { - "name": "petId", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - }, - "nullable": false - } - ], - "responses": { - "200": { - "x-nullable": true, - "description": "", - "content": { - "application/json": { - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/Pet" - } - ] - } - } - } - }, - "400": { - "x-nullable": true, - "description": "", - "content": { - "application/json": { - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/SerializableError" - } - ] - } - } - } - }, - "404": { - "description": "" - } - } - }, - "post": { - "tags": [ - "Pet" - ], - "operationId": "Pet_EditPetWithFormData", - "parameters": [ - { - "name": "petId", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - }, - "nullable": false - }, - { - "name": "pet", - "in": "formData", - "schema": { - "$ref": "#/components/schemas/Pet" - }, - "nullable": true - } - ], - "responses": { - "400": { - "x-nullable": true, - "description": "", - "content": { - "application/json": { - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/SerializableError" - } - ] - } - } - } - }, - "404": { - "description": "" - } - } - }, - "delete": { - "tags": [ - "Pet" - ], - "operationId": "Pet_DeletePet", - "parameters": [ - { - "name": "petId", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - }, - "nullable": false - } - ], - "responses": { - "400": { - "x-nullable": true, - "description": "", - "content": { - "application/json": { - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/SerializableError" - } - ] - } - } - } - }, - "404": { - "description": "" - } - } - } - }, - "/pet/{petId}/uploadImage": { - "post": { - "tags": [ - "Pet" - ], - "operationId": "Pet_UploadImage", - "parameters": [ - { - "name": "petId", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - }, - "nullable": false - }, - { - "type": "file", - "name": "file", - "in": "formData", - "schema": { - "type": "file" - }, - "nullable": true - } - ], - "responses": { - "200": { - "x-nullable": true, - "description": "", - "content": { - "application/json": { - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/ApiResponse" - } - ] - } - } - } - }, - "400": { - "x-nullable": true, - "description": "", - "content": { - "application/json": { - "schema": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/SerializableError" - } - ] - } - } - } - }, - "404": { - "description": "" - } - } - } - }, - "/pet/RequiredAndOptional": { - "post": { - "tags": [ - "Pet" - ], - "operationId": "Pet_RequiredAndOptional", - "parameters": [ - { - "name": "int_RequiredAndNotNullable", - "in": "query", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - }, - "nullable": false - }, - { - "name": "int_RequiredAndNullable", - "in": "query", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - }, - "nullable": true - }, - { - "name": "string_RequiredAndNullable", - "in": "query", - "required": true, - "schema": { - "type": "string" - }, - "nullable": true - }, - { - "name": "string_RequiredAndNotNullable", - "in": "query", - "required": true, - "schema": { - "type": "string" - }, - "nullable": false - }, - { - "name": "decimalWithDefault_NotRequiredAndNotNullable", - "in": "query", - "schema": { - "type": "number", - "format": "decimal" - }, - "default": 1.0, - "nullable": false - }, - { - "name": "decimalWithDefault_NotRequiredAndNullable", - "in": "query", - "schema": { - "type": "number", - "format": "decimal" - }, - "default": 1.0, - "nullable": true - }, - { - "name": "stringWithDefault_NotRequiredAndNullable", - "in": "query", - "schema": { - "type": "string" - }, - "default": "foo", - "nullable": true - }, - { - "name": "stringWithDefault_NotRequiredAndNotNullable", - "in": "query", - "schema": { - "type": "string" - }, - "default": "foo", - "nullable": false - } - ], - "responses": { - "200": { - "description": "" - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "type": "object", - "additionalProperties": false, - "required": [ - "name", - "status" - ], - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "age": { - "type": "integer", - "format": "int32", - "maximum": 150.0, - "minimum": 0.0 - }, - "category": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/Category" - } - ] - }, - "hasVaccinations": { - "type": "boolean" - }, - "name": { - "type": "string", - "maxLength": 50, - "minLength": 2 - }, - "images": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Image" - } - }, - "tags": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Tag" - } - }, - "status": { - "type": "string", - "minLength": 1 - } - } - }, - "Category": { - "type": "object", - "additionalProperties": false, - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "name": { - "type": "string" - } - } - }, - "Image": { - "type": "object", - "additionalProperties": false, - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "url": { - "type": "string" - } - } - }, - "Tag": { - "type": "object", - "additionalProperties": false, - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "name": { - "type": "string" - } - } - }, - "SerializableError": { - "type": "object", - "additionalProperties": false, - "allOf": [ - { - "type": "object", - "additionalProperties": {} - } - ] - }, - "ApiResponse": { - "type": "object", - "additionalProperties": false, - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "message": { - "type": "string" - }, - "type": { - "type": "string" - } - } - } - } - } -} \ No newline at end of file diff --git a/src/NSwag.Sample.NETCore20/Program.cs b/src/NSwag.Sample.NETCore20/Program.cs deleted file mode 100644 index 259dc400b9..0000000000 --- a/src/NSwag.Sample.NETCore20/Program.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Microsoft.AspNetCore; -using Microsoft.AspNetCore.Hosting; - -namespace NSwag.Sample.NETCore20 -{ - public class Program - { - public static void Main(string[] args) - { - BuildWebHost(args).Run(); - } - - public static IWebHost BuildWebHost(string[] args) => - WebHost.CreateDefaultBuilder(args) - .UseStartup() - .Build(); - } -} diff --git a/src/NSwag.Sample.NETCore20/Properties/launchSettings.json b/src/NSwag.Sample.NETCore20/Properties/launchSettings.json deleted file mode 100644 index 64a4855280..0000000000 --- a/src/NSwag.Sample.NETCore20/Properties/launchSettings.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:65384/", - "sslPort": 0 - } - }, - "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "launchUrl": "swagger", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "NSwag.Sample.NETCore20": { - "commandName": "Project", - "launchBrowser": true, - "launchUrl": "swagger", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - }, - "applicationUrl": "http://localhost:65385/" - } - } -} \ No newline at end of file diff --git a/src/NSwag.Sample.NETCore20/Startup.cs b/src/NSwag.Sample.NETCore20/Startup.cs deleted file mode 100644 index 7999a79832..0000000000 --- a/src/NSwag.Sample.NETCore20/Startup.cs +++ /dev/null @@ -1,123 +0,0 @@ -using System.Reflection; -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using NSwag.AspNetCore; -using NSwag.Sample.NETCore20.Part; -using NSwag.Generation.Processors.Security; - -namespace NSwag.Sample.NETCore20 -{ - public class Startup - { - public Startup(IConfiguration configuration) - { - Configuration = configuration; - } - - public IConfiguration Configuration { get; } - - public void ConfigureServices(IServiceCollection services) - { - services.AddMvc(). - AddApplicationPart(typeof(SampleController).GetTypeInfo().Assembly); - - // Add OpenAPI and Swagger DI services and configure documents - - // Adds the NSwag services - services - // Register a Swagger 2.0 document generator - .AddSwaggerDocument(document => - { - document.DocumentName = "swagger"; - // Add operation security scope processor - document.OperationProcessors.Add(new OperationSecurityScopeProcessor("TEST_APIKEY")); - // Add custom document processors, etc. - document.DocumentProcessors.Add(new SecurityDefinitionAppender("TEST_APIKEY", new OpenApiSecurityScheme - { - Type = OpenApiSecuritySchemeType.ApiKey, - Name = "TEST_HEADER", - In = OpenApiSecurityApiKeyLocation.Header, - Description = "TEST_DESCRIPTION" - })); - // Post process the generated document - document.PostProcess = d => d.Info.Title = "Hello world!"; - }) - // Register an OpenAPI 3.0 document generator - .AddOpenApiDocument(document => document.DocumentName = "openapi"); - } - - public void Configure(IApplicationBuilder app, IHostingEnvironment env) - { - if (env.IsDevelopment()) - { - app.UseDeveloperExceptionPage(); - } - - app.UseMvc(); - - //// Add OpenAPI and Swagger middlewares to serve documents and web UIs - - // URLs: - // - http://localhost:65384/swagger/v1/swagger.json - // - http://localhost:65384/swagger - // - http://localhost:65384/redoc - // - http://localhost:65384/openapi - // - http://localhost:65384/openapi_redoc - - // Add Swagger 2.0 document serving middleware - app.UseOpenApi(options => - { - options.DocumentName = "swagger"; - options.Path = "/swagger/v1/swagger.json"; - }); - - // Add web UIs to interact with the document - app.UseSwaggerUi3(options => - { - // Define web UI route - options.Path = "/swagger"; - - // Define OpenAPI/Swagger document route (defined with UseSwaggerWithApiExplorer) - options.DocumentPath = "/swagger/v1/swagger.json"; - }); - app.UseReDoc(options => - { - options.Path = "/redoc"; - options.DocumentPath = "/swagger/v1/swagger.json"; - }); - - //// Add OpenAPI 3.0 document serving middleware - app.UseOpenApi(options => - { - options.DocumentName = "openapi"; - options.Path = "/openapi/v1/openapi.json"; - }); - - // Add web UIs to interact with the document - app.UseSwaggerUi3(options => - { - options.Path = "/openapi"; - options.DocumentPath = "/openapi/v1/openapi.json"; - }); - app.UseReDoc(options => - { - options.Path = "/openapi_redoc"; - options.DocumentPath = "/openapi/v1/openapi.json"; - }); - - // Add Swagger UI with multiple documents - app.UseSwaggerUi3(options => - { - // Add multiple OpenAPI/Swagger documents to the Swagger UI 3 web frontend - options.SwaggerRoutes.Add(new SwaggerUi3Route("Swagger", "/swagger/v1/swagger.json")); - options.SwaggerRoutes.Add(new SwaggerUi3Route("Openapi", "/openapi/v1/openapi.json")); - options.SwaggerRoutes.Add(new SwaggerUi3Route("Petstore", "http://petstore.swagger.io/v2/swagger.json")); - - // Define web UI route - options.Path = "/swagger_all"; - }); - } - } -} \ No newline at end of file diff --git a/src/NSwag.Sample.NETCore20/Update-SwaggerSpecs.ps1 b/src/NSwag.Sample.NETCore20/Update-SwaggerSpecs.ps1 deleted file mode 100644 index 144649d80b..0000000000 --- a/src/NSwag.Sample.NETCore20/Update-SwaggerSpecs.ps1 +++ /dev/null @@ -1,18 +0,0 @@ -Try -{ - New-Item -ItemType directory -Force -Path "$PSScriptRoot/Output" - - Invoke-WebRequest -Uri 'http://localhost:65384/swagger_new_ui/v1/swagger.json' -OutFile "$PSScriptRoot/Output/swagger_new_v2.json" - - Invoke-WebRequest -Uri 'http://localhost:65384/swagger_new_v3/v1/swagger.json' -OutFile "$PSScriptRoot/Output/swagger_new_v3.json" - - Invoke-WebRequest -Uri 'http://localhost:65384/swagger_old_ui/v1/swagger.json' -OutFile "$PSScriptRoot/Output/swagger_old_v2.json" - - Invoke-WebRequest -Uri 'http://localhost:65384/swagger_old_v3/v1/swagger.json' -OutFile "$PSScriptRoot/Output/swagger_old_v3.json" -} -Catch -{ - "Could not download the OpenAPI/Swagger specifications: " - Throw -} - diff --git a/src/NSwag.Sample.NETCore20/appsettings.Development.json b/src/NSwag.Sample.NETCore20/appsettings.Development.json deleted file mode 100644 index fa8ce71a97..0000000000 --- a/src/NSwag.Sample.NETCore20/appsettings.Development.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "Logging": { - "IncludeScopes": false, - "LogLevel": { - "Default": "Debug", - "System": "Information", - "Microsoft": "Information" - } - } -} diff --git a/src/NSwag.Sample.NETCore20/appsettings.json b/src/NSwag.Sample.NETCore20/appsettings.json deleted file mode 100644 index 26bb0ac7ac..0000000000 --- a/src/NSwag.Sample.NETCore20/appsettings.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "Logging": { - "IncludeScopes": false, - "Debug": { - "LogLevel": { - "Default": "Warning" - } - }, - "Console": { - "LogLevel": { - "Default": "Warning" - } - } - } -} diff --git a/src/NSwag.Sample.NETCore20/nswag.json b/src/NSwag.Sample.NETCore20/nswag.json deleted file mode 100644 index 60ab8fa8b0..0000000000 --- a/src/NSwag.Sample.NETCore20/nswag.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "runtime": "NetCore21", - "defaultVariables": "", - "documentGenerator": { - "aspNetCoreToOpenApi": { - "project": null, - "msBuildProjectExtensionsPath": null, - "configuration": null, - "runtime": null, - "targetFramework": null, - "noBuild": false, - "verbose": true, - "workingDirectory": null, - "requireParametersWithoutDefault": false, - "apiGroupNames": null, - "defaultPropertyNameHandling": "Default", - "defaultReferenceTypeNullHandling": "Null", - "defaultResponseReferenceTypeNullHandling": "NotNull", - "defaultEnumHandling": "Integer", - "flattenInheritanceHierarchy": false, - "generateKnownTypes": true, - "generateEnumMappingDescription": false, - "generateXmlObjects": false, - "generateAbstractProperties": false, - "generateAbstractSchemas": true, - "ignoreObsoleteProperties": false, - "allowReferencesWithProperties": false, - "excludedTypeNames": [], - "serviceHost": null, - "serviceBasePath": null, - "serviceSchemes": [], - "infoTitle": "My Title", - "infoDescription": null, - "infoVersion": "1.0.0", - "documentTemplate": null, - "documentProcessorTypes": [], - "operationProcessorTypes": [], - "typeNameGeneratorType": null, - "schemaNameGeneratorType": null, - "contractResolverType": null, - "serializerSettingsType": null, - "useDocumentProvider": true, - "documentName": "swagger", - "aspNetCoreEnvironment": null, - "createWebHostBuilderMethod": null, - "startupType": null, - "allowNullableBodyParameters": false, - "output": "swagger.json", - "outputType": "Swagger2", - "assemblyPaths": [ - "bin/Debug/netcoreapp2.0/NSwag.Sample.NETCore20.dll" - ], - "assemblyConfig": null, - "referencePaths": [], - "useNuGetCache": false - } - }, - "codeGenerators": {} -} \ No newline at end of file diff --git a/src/NSwag.Sample.NETCore20/swagger.json b/src/NSwag.Sample.NETCore20/swagger.json deleted file mode 100644 index a32d73b7b4..0000000000 --- a/src/NSwag.Sample.NETCore20/swagger.json +++ /dev/null @@ -1,758 +0,0 @@ -{ - "x-generator": "NSwag v13.10.8.0 (NJsonSchema v10.3.11.0 (Newtonsoft.Json v11.0.0.0))", - "swagger": "2.0", - "info": { - "title": "Hello world!", - "version": "1.0.0" - }, - "paths": { - "/pet": { - "post": { - "tags": [ - "Pet" - ], - "operationId": "Pet_AddPet", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "parameters": [ - { - "name": "pet", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/Pet" - }, - "x-nullable": false - } - ], - "responses": { - "400": { - "x-nullable": false, - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - } - } - }, - "security": [ - { - "TEST_APIKEY": [] - } - ] - }, - "put": { - "tags": [ - "Pet" - ], - "operationId": "Pet_EditPet", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "parameters": [ - { - "name": "pet", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/Pet" - }, - "x-nullable": false - } - ], - "responses": { - "400": { - "x-nullable": false, - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - } - } - }, - "security": [ - { - "TEST_APIKEY": [] - } - ] - } - }, - "/pet/findByStatus": { - "get": { - "tags": [ - "Pet" - ], - "operationId": "Pet_FindByStatusAll", - "produces": [ - "application/json" - ], - "parameters": [ - { - "type": "array", - "name": "status", - "in": "query", - "collectionFormat": "multi", - "x-nullable": true, - "items": { - "type": "string" - } - } - ], - "responses": { - "200": { - "x-nullable": false, - "description": "", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/Pet" - } - } - }, - "400": { - "x-nullable": false, - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - } - } - }, - "security": [ - { - "TEST_APIKEY": [] - } - ] - } - }, - "/pet/findByStatus/{skip}/{sortOrder}": { - "get": { - "tags": [ - "Pet" - ], - "operationId": "Pet_FindByStatus", - "produces": [ - "application/json" - ], - "parameters": [ - { - "type": "array", - "name": "status", - "in": "query", - "collectionFormat": "multi", - "x-nullable": true, - "items": { - "type": "string" - } - }, - { - "type": "integer", - "name": "skip", - "in": "path", - "required": true, - "format": "int32", - "x-nullable": false - }, - { - "type": "integer", - "name": "sortOrder", - "in": "path", - "required": true, - "format": "int32", - "x-nullable": false - } - ], - "responses": { - "200": { - "x-nullable": false, - "description": "", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/Pet" - } - } - }, - "400": { - "x-nullable": false, - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - } - } - }, - "security": [ - { - "TEST_APIKEY": [] - } - ] - } - }, - "/pet/findByCategory": { - "get": { - "tags": [ - "Pet" - ], - "operationId": "Pet_FindByCategory", - "produces": [ - "application/json" - ], - "parameters": [ - { - "type": "string", - "name": "category", - "in": "query", - "x-nullable": true - } - ], - "responses": { - "200": { - "x-nullable": false, - "description": "", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/Pet" - } - } - }, - "400": { - "x-nullable": false, - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - } - } - }, - "security": [ - { - "TEST_APIKEY": [] - } - ] - } - }, - "/pet/{petId}": { - "get": { - "tags": [ - "Pet" - ], - "operationId": "Pet_FindById", - "produces": [ - "application/json" - ], - "parameters": [ - { - "type": "integer", - "name": "petId", - "in": "path", - "required": true, - "format": "int32", - "x-nullable": false - } - ], - "responses": { - "200": { - "x-nullable": false, - "description": "", - "schema": { - "$ref": "#/definitions/Pet" - } - }, - "400": { - "x-nullable": false, - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - } - }, - "404": { - "description": "" - } - }, - "security": [ - { - "TEST_APIKEY": [] - } - ] - }, - "post": { - "tags": [ - "Pet" - ], - "operationId": "Pet_EditPetWithFormData", - "produces": [ - "application/json" - ], - "parameters": [ - { - "type": "integer", - "name": "petId", - "in": "path", - "required": true, - "format": "int32", - "x-nullable": false - }, - { - "type": "integer", - "name": "Id", - "in": "formData", - "format": "int32", - "x-nullable": false - }, - { - "type": "integer", - "name": "Age", - "in": "formData", - "format": "int32", - "maximum": 150.0, - "minimum": 0.0, - "x-nullable": false - }, - { - "type": "integer", - "name": "Category.Id", - "in": "formData", - "format": "int32", - "x-nullable": false - }, - { - "type": "string", - "name": "Category.Name", - "in": "formData", - "x-nullable": true - }, - { - "type": "boolean", - "name": "HasVaccinations", - "in": "formData", - "x-nullable": false - }, - { - "type": "string", - "name": "Name", - "in": "formData", - "maxLength": 50, - "minLength": 2, - "x-nullable": true - }, - { - "type": "array", - "name": "Images", - "in": "formData", - "collectionFormat": "multi", - "x-nullable": true, - "items": { - "$ref": "#/definitions/Image" - } - }, - { - "type": "array", - "name": "Tags", - "in": "formData", - "collectionFormat": "multi", - "x-nullable": true, - "items": { - "$ref": "#/definitions/Tag" - } - }, - { - "type": "string", - "name": "Status", - "in": "formData", - "x-nullable": true - } - ], - "responses": { - "400": { - "x-nullable": false, - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - } - }, - "404": { - "description": "" - } - }, - "security": [ - { - "TEST_APIKEY": [] - } - ] - }, - "delete": { - "tags": [ - "Pet" - ], - "operationId": "Pet_DeletePet", - "produces": [ - "application/json" - ], - "parameters": [ - { - "type": "integer", - "name": "petId", - "in": "path", - "required": true, - "format": "int32", - "x-nullable": false - } - ], - "responses": { - "400": { - "x-nullable": false, - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - } - }, - "404": { - "description": "" - } - }, - "security": [ - { - "TEST_APIKEY": [] - } - ] - } - }, - "/pet/{petId}/uploadImage": { - "post": { - "tags": [ - "Pet" - ], - "operationId": "Pet_UploadImage", - "produces": [ - "application/json" - ], - "parameters": [ - { - "type": "integer", - "name": "petId", - "in": "path", - "required": true, - "format": "int32", - "x-nullable": false - }, - { - "type": "string", - "name": "ContentType", - "in": "query", - "x-nullable": true - }, - { - "type": "string", - "name": "ContentDisposition", - "in": "query", - "x-nullable": true - }, - { - "type": "object", - "name": "Headers", - "in": "query", - "x-schema": { - "$ref": "#/definitions/IHeaderDictionary" - }, - "x-nullable": true - }, - { - "type": "integer", - "name": "Length", - "in": "query", - "format": "int64", - "x-nullable": false - }, - { - "type": "string", - "name": "Name", - "in": "query", - "x-nullable": true - }, - { - "type": "string", - "name": "FileName", - "in": "query", - "x-nullable": true - } - ], - "responses": { - "200": { - "x-nullable": false, - "description": "", - "schema": { - "$ref": "#/definitions/ApiResponse" - } - }, - "400": { - "x-nullable": false, - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - } - }, - "404": { - "description": "" - } - }, - "security": [ - { - "TEST_APIKEY": [] - } - ] - } - }, - "/pet/RequiredAndOptional": { - "post": { - "tags": [ - "Pet" - ], - "operationId": "Pet_RequiredAndOptional", - "parameters": [ - { - "type": "integer", - "name": "int_RequiredAndNotNullable", - "in": "query", - "format": "int32", - "x-nullable": false - }, - { - "type": "integer", - "name": "int_RequiredAndNullable", - "in": "query", - "format": "int32", - "x-nullable": true - }, - { - "type": "string", - "name": "string_RequiredAndNullable", - "in": "query", - "x-nullable": true - }, - { - "type": "string", - "name": "string_RequiredAndNotNullable", - "in": "query", - "x-nullable": false - }, - { - "type": "number", - "name": "decimalWithDefault_NotRequiredAndNotNullable", - "in": "query", - "format": "decimal", - "default": 1.0, - "x-nullable": false - }, - { - "type": "number", - "name": "decimalWithDefault_NotRequiredAndNullable", - "in": "query", - "format": "decimal", - "default": 1.0, - "x-nullable": true - }, - { - "type": "string", - "name": "stringWithDefault_NotRequiredAndNullable", - "in": "query", - "default": "foo", - "x-nullable": true - }, - { - "type": "string", - "name": "stringWithDefault_NotRequiredAndNotNullable", - "in": "query", - "default": "foo", - "x-nullable": false - } - ], - "responses": { - "200": { - "description": "" - } - }, - "security": [ - { - "TEST_APIKEY": [] - } - ] - } - }, - "/sample": { - "post": { - "tags": [ - "Sample" - ], - "operationId": "Sample_GetSample", - "produces": [ - "text/plain", - "application/json", - "text/json" - ], - "responses": { - "200": { - "x-nullable": false, - "description": "", - "schema": { - "type": "string" - } - } - }, - "security": [ - { - "TEST_APIKEY": [] - } - ] - } - } - }, - "definitions": { - "SerializableError": { - "type": "object", - "additionalProperties": {} - }, - "Pet": { - "type": "object", - "required": [ - "id", - "age", - "hasVaccinations", - "name", - "status" - ], - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "age": { - "type": "integer", - "format": "int32", - "maximum": 150.0, - "minimum": 0.0 - }, - "category": { - "$ref": "#/definitions/Category" - }, - "hasVaccinations": { - "type": "boolean" - }, - "name": { - "type": "string", - "maxLength": 50, - "minLength": 2 - }, - "images": { - "type": "array", - "items": { - "$ref": "#/definitions/Image" - } - }, - "tags": { - "type": "array", - "items": { - "$ref": "#/definitions/Tag" - } - }, - "status": { - "type": "string", - "minLength": 1 - } - } - }, - "Category": { - "type": "object", - "required": [ - "id" - ], - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "name": { - "type": "string" - } - } - }, - "Image": { - "type": "object", - "required": [ - "id" - ], - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "url": { - "type": "string" - } - } - }, - "Tag": { - "type": "object", - "required": [ - "id" - ], - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "name": { - "type": "string" - } - } - }, - "ApiResponse": { - "type": "object", - "required": [ - "code" - ], - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "message": { - "type": "string" - }, - "type": { - "type": "string" - } - } - }, - "IHeaderDictionary": { - "type": "object", - "x-abstract": true, - "required": [ - "Item" - ], - "properties": { - "Item": { - "type": "array", - "items": { - "additionalProperties": {} - } - }, - "ContentLength": { - "type": "integer", - "format": "int64" - } - } - } - }, - "securityDefinitions": { - "TEST_APIKEY": { - "type": "apiKey", - "description": "TEST_DESCRIPTION", - "name": "TEST_HEADER", - "in": "header" - } - } -} \ No newline at end of file diff --git a/src/NSwag.Sample.NETCore21/Controllers/PetController.cs b/src/NSwag.Sample.NETCore21/Controllers/PetController.cs deleted file mode 100644 index 9a0e94c010..0000000000 --- a/src/NSwag.Sample.NETCore21/Controllers/PetController.cs +++ /dev/null @@ -1,161 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Net; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.ModelBinding; - -namespace NSwag.Sample -{ - // Intentionally not sharing the controller source code with the 1.1 and 2.0 samples. - // 2.1 introduces enhancements to the programming model for API but expects you to - // write some different code. - // - // This sample is similar to http://petstore.swagger.io/#/ - [ApiController] - [Route("/pet")] - public class PetController : ControllerBase - { - /// - /// Creates an order - /// - /// Order created - /// Order invalid - [HttpPost("createOrder")] - [ProducesResponseType(typeof(int), 201)] - [ProducesResponseType(typeof(IDictionary), 400)] - public void CreateOrder() - { - - } - - [HttpPost] - [Consumes("application/json")] - [Produces("application/json")] - [ProducesResponseType(StatusCodes.Status204NoContent)] - [ProducesResponseType(typeof(SerializableError), StatusCodes.Status400BadRequest)] - [return: Description("My success response description.")] - public async Task AddPet([FromBody] Pet pet) - { - await Task.Delay(0); - return new EmptyResult(); - } - - [HttpPut] - [Consumes("application/json")] - [Produces("application/json")] - [ProducesResponseType(StatusCodes.Status204NoContent)] - [ProducesResponseType(typeof(SerializableError), StatusCodes.Status400BadRequest)] - public async Task EditPet([FromBody] Pet pet) - { - if (pet.Id == 0) - { - return NotFound(); - } - - await Task.Delay(0); - return new EmptyResult(); - } - - // 'status' is intended to be an optional query string parameter - // Sample with ActionResult auto-detection - [HttpGet("findByStatus")] - [Produces("application/json")] - public async Task>> FindByStatus(string[] status) - { - await Task.Delay(0); - return new ObjectResult(Array.Empty()); - } - - // Included this extra action not present in http://petstore.swagger.io/#/ - // to represent an action with a required query parameter. - [HttpGet("findByCategory")] - [Produces("application/json")] - [ProducesResponseType(typeof(IEnumerable), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(SerializableError), StatusCodes.Status400BadRequest)] - public async Task>> FindByCategory([BindRequired] string category) - { - await Task.Delay(0); - return new ObjectResult(Array.Empty()); - } - - [HttpGet("{petId}", Name = "FindPetById")] - [Produces("application/json")] - [ProducesResponseType(typeof(Pet), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(SerializableError), StatusCodes.Status400BadRequest)] - [ProducesResponseType(StatusCodes.Status404NotFound)] - public async Task> FindById(int petId) - { - if (!ModelState.IsValid) - { - return BadRequest(ModelState); - } - - await Task.Delay(0); - if (petId == 0) - { - return NotFound(); - } - - return Ok(new Pet()); - } - - [HttpPost("{petId}")] - [Consumes("application/www-form-url-encoded")] - [Produces("application/json")] - [ProducesResponseType(StatusCodes.Status204NoContent)] - [ProducesResponseType(typeof(SerializableError), StatusCodes.Status400BadRequest)] - [ProducesResponseType(StatusCodes.Status404NotFound)] - public async Task EditPet(int petId, [FromForm] Pet pet) - { - if (petId == 0) - { - return NotFound(); - } - - await Task.Delay(0); - return new EmptyResult(); - } - - [HttpDelete("{petId}")] - [Produces("application/json")] - [ProducesResponseType(StatusCodes.Status204NoContent)] - [ProducesResponseType(typeof(SerializableError), StatusCodes.Status400BadRequest)] - [ProducesResponseType(StatusCodes.Status404NotFound)] - public async Task DeletePet(int petId) - { - if (petId == 0) - { - return NotFound(); - } - - await Task.Delay(0); - return new EmptyResult(); - } - - [HttpPost("{petId}/uploadImage")] - [Consumes("multipart/form-data")] - [Produces("application/json")] - [ProducesResponseType(typeof(ApiResponse), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(SerializableError), StatusCodes.Status400BadRequest)] - [ProducesResponseType(StatusCodes.Status404NotFound)] - public async Task> UploadImage(int petId, IFormFile file) - { - if (petId == 0) - { - return NotFound(); - } - - await Task.Delay(0); - return Ok(new ApiResponse()); - } - - [HttpPost("file")] - public ActionResult GetFile() - { - return NoContent(); - } - } -} \ No newline at end of file diff --git a/src/NSwag.Sample.NETCore21/NSwag.Sample.NETCore21.csproj b/src/NSwag.Sample.NETCore21/NSwag.Sample.NETCore21.csproj deleted file mode 100644 index d958c42da8..0000000000 --- a/src/NSwag.Sample.NETCore21/NSwag.Sample.NETCore21.csproj +++ /dev/null @@ -1,30 +0,0 @@ - - - - netcoreapp2.1 - true - - $(NoWarn),1591 - - - - - Models\%(RecursiveDir)\%(FileName)%(Extension) - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/NSwag.Sample.NETCore21/Program.cs b/src/NSwag.Sample.NETCore21/Program.cs deleted file mode 100644 index bbe0a68db5..0000000000 --- a/src/NSwag.Sample.NETCore21/Program.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore; -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Logging; - -namespace NSwag.Sample.NETCore21 -{ - public class Program - { - public static void Main(string[] args) - { - CreateWebHostBuilder(args).Build().Run(); - } - - public static IWebHostBuilder CreateWebHostBuilder(string[] args) => - WebHost.CreateDefaultBuilder(args) - .UseStartup(); - } -} diff --git a/src/NSwag.Sample.NETCore21/Properties/launchSettings.json b/src/NSwag.Sample.NETCore21/Properties/launchSettings.json deleted file mode 100644 index 3c6ca53ffa..0000000000 --- a/src/NSwag.Sample.NETCore21/Properties/launchSettings.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:32367", - "sslPort": 44370 - } - }, - "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "launchUrl": "swagger", - "environmentVariables": { - "ASPNETCORE_HTTPS_PORT": "44370", - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "NSwag.Sample.NETCore21": { - "commandName": "Project", - "launchBrowser": true, - "launchUrl": "swagger", - "environmentVariables": { - "ASPNETCORE_URLS": "https://localhost:5001;http://localhost:5000", - "ASPNETCORE_ENVIRONMENT": "Development" - } - } - } -} \ No newline at end of file diff --git a/src/NSwag.Sample.NETCore21/Startup.cs b/src/NSwag.Sample.NETCore21/Startup.cs deleted file mode 100644 index 7e5a05a06b..0000000000 --- a/src/NSwag.Sample.NETCore21/Startup.cs +++ /dev/null @@ -1,58 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; - -namespace NSwag.Sample.NETCore21 -{ - public class Startup - { - public Startup(IConfiguration configuration) - { - Configuration = configuration; - } - - public IConfiguration Configuration { get; } - - public void ConfigureServices(IServiceCollection services) - { - services - .AddMvc(options => options.AllowEmptyInputInBodyModelBinding = false) - .SetCompatibilityVersion(CompatibilityVersion.Version_2_1); - - // Add NSwag OpenAPI/Swagger DI services and configure documents - // For more advanced setup, see NSwag.Sample.NETCore20 project - - services.AddOpenApiDocument(document => document.DocumentName = "a"); - services.AddSwaggerDocument(document => document.DocumentName = "b"); - } - - public void Configure(IApplicationBuilder app, IHostingEnvironment env) - { - if (env.IsDevelopment()) - { - app.UseDeveloperExceptionPage(); - } - else - { - app.UseHsts(); - } - - app.UseHttpsRedirection(); - app.UseMvc(); - - // Add middlewares to service the OpenAPI/Swagger document and the web UI - - // URLs: - // - http://localhost:32367/swagger/a/swagger.json - // - http://localhost:32367/swagger/b/swagger.json - // - http://localhost:32367/swagger - -#pragma warning disable 618 - app.UseSwagger(); // registers the two documents in separate routes -#pragma warning restore 618 - app.UseSwaggerUi3(); // registers a single Swagger UI (v3) with the two documents - } - } -} \ No newline at end of file diff --git a/src/NSwag.Sample.NETCore21/appsettings.Development.json b/src/NSwag.Sample.NETCore21/appsettings.Development.json deleted file mode 100644 index 0623a3f445..0000000000 --- a/src/NSwag.Sample.NETCore21/appsettings.Development.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Debug", - "System": "Information", - "Microsoft": "Information" - } - } -} diff --git a/src/NSwag.Sample.NETCore21/appsettings.json b/src/NSwag.Sample.NETCore21/appsettings.json deleted file mode 100644 index 09cf536c1e..0000000000 --- a/src/NSwag.Sample.NETCore21/appsettings.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Warning" - } - } -} diff --git a/src/NSwag.Sample.NETCore21/nswag_assembly.nswag b/src/NSwag.Sample.NETCore21/nswag_assembly.nswag deleted file mode 100644 index 3e348e7642..0000000000 --- a/src/NSwag.Sample.NETCore21/nswag_assembly.nswag +++ /dev/null @@ -1,59 +0,0 @@ -{ - "runtime": "NetCore21", - "defaultVariables": null, - "documentGenerator": { - "aspNetCoreToOpenApi": { - "project": "", - "msBuildProjectExtensionsPath": null, - "configuration": null, - "runtime": null, - "targetFramework": null, - "noBuild": false, - "verbose": false, - "workingDirectory": null, - "requireParametersWithoutDefault": true, - "apiGroupNames": null, - "defaultPropertyNameHandling": "Default", - "defaultReferenceTypeNullHandling": "Null", - "defaultResponseReferenceTypeNullHandling": "NotNull", - "defaultEnumHandling": "Integer", - "flattenInheritanceHierarchy": false, - "generateKnownTypes": true, - "generateEnumMappingDescription": false, - "generateXmlObjects": false, - "generateAbstractProperties": false, - "generateAbstractSchemas": true, - "ignoreObsoleteProperties": false, - "allowReferencesWithProperties": false, - "excludedTypeNames": [], - "serviceHost": null, - "serviceBasePath": null, - "serviceSchemes": [], - "infoTitle": "ljlkjlkj", - "infoDescription": null, - "infoVersion": "", - "documentTemplate": null, - "documentProcessorTypes": [], - "operationProcessorTypes": [], - "typeNameGeneratorType": null, - "schemaNameGeneratorType": null, - "contractResolverType": null, - "serializerSettingsType": null, - "useDocumentProvider": false, - "documentName": "v1", - "aspNetCoreEnvironment": null, - "createWebHostBuilderMethod": null, - "startupType": null, - "allowNullableBodyParameters": true, - "output": "swagger_assembly_cli.json", - "outputType": "Swagger2", - "assemblyPaths": [ - "bin/Debug/netcoreapp2.1/NSwag.Sample.NETCore21.dll" - ], - "assemblyConfig": null, - "referencePaths": [], - "useNuGetCache": false - } - }, - "codeGenerators": {} -} \ No newline at end of file diff --git a/src/NSwag.Sample.NETCore21/nswag_project.nswag b/src/NSwag.Sample.NETCore21/nswag_project.nswag deleted file mode 100644 index cfd575a0e8..0000000000 --- a/src/NSwag.Sample.NETCore21/nswag_project.nswag +++ /dev/null @@ -1,57 +0,0 @@ -{ - "runtime": "NetCore21", - "defaultVariables": null, - "documentGenerator": { - "aspNetCoreToOpenApi": { - "project": "NSwag.Sample.NETCore21.csproj", - "msBuildProjectExtensionsPath": null, - "configuration": null, - "runtime": null, - "targetFramework": null, - "noBuild": true, - "verbose": false, - "workingDirectory": null, - "requireParametersWithoutDefault": true, - "apiGroupNames": null, - "defaultPropertyNameHandling": "Default", - "defaultReferenceTypeNullHandling": "Null", - "defaultResponseReferenceTypeNullHandling": "NotNull", - "defaultEnumHandling": "Integer", - "flattenInheritanceHierarchy": false, - "generateKnownTypes": true, - "generateEnumMappingDescription": false, - "generateXmlObjects": false, - "generateAbstractProperties": false, - "generateAbstractSchemas": true, - "ignoreObsoleteProperties": false, - "allowReferencesWithProperties": false, - "excludedTypeNames": [], - "serviceHost": null, - "serviceBasePath": null, - "serviceSchemes": [], - "infoTitle": "My Title", - "infoDescription": null, - "infoVersion": "1.0.0", - "documentTemplate": null, - "documentProcessorTypes": [], - "operationProcessorTypes": [], - "typeNameGeneratorType": null, - "schemaNameGeneratorType": null, - "contractResolverType": null, - "serializerSettingsType": null, - "useDocumentProvider": false, - "documentName": "v1", - "aspNetCoreEnvironment": null, - "createWebHostBuilderMethod": null, - "startupType": null, - "allowNullableBodyParameters": false, - "output": "swagger_project_cli.json", - "outputType": "Swagger2", - "assemblyPaths": [], - "assemblyConfig": null, - "referencePaths": [], - "useNuGetCache": false - } - }, - "codeGenerators": {} -} \ No newline at end of file diff --git a/src/NSwag.Sample.NETCore21/oldswagger.json b/src/NSwag.Sample.NETCore21/oldswagger.json deleted file mode 100644 index 456d392bb2..0000000000 --- a/src/NSwag.Sample.NETCore21/oldswagger.json +++ /dev/null @@ -1,376 +0,0 @@ -{ - "x-generator": "NSwag v11.15.4.0 (NJsonSchema v9.10.31.0 (Newtonsoft.Json v10.0.0.0))", - "swagger": "2.0", - "info": { - "title": "", - "version": "" - }, - "host": "localhost:5001", - "basePath": "", - "schemes": [ - "https" - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "paths": { - "/pet": { - "post": { - "tags": [ - "Pet" - ], - "operationId": "Pet_AddPet", - "parameters": [ - { - "name": "pet", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/Pet" - }, - "x-nullable": true - } - ], - "responses": { - "400": { - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - }, - "x-nullable": true - } - } - }, - "put": { - "tags": [ - "Pet" - ], - "operationId": "Pet_EditPet", - "parameters": [ - { - "name": "pet", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/Pet" - }, - "x-nullable": true - } - ], - "responses": { - "400": { - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - }, - "x-nullable": true - } - } - } - }, - "/pet/findByStatus": { - "get": { - "tags": [ - "Pet" - ], - "operationId": "Pet_FindByStatus", - "parameters": [ - { - "type": "array", - "name": "status", - "in": "query", - "x-nullable": true, - "collectionFormat": "multi", - "items": { - "type": "string" - } - } - ], - "responses": { - "400": { - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - }, - "x-nullable": true - } - } - } - }, - "/pet/findByCategory": { - "get": { - "tags": [ - "Pet" - ], - "operationId": "Pet_FindByCategory", - "parameters": [ - { - "type": "string", - "name": "category", - "in": "query", - "required": true, - "x-nullable": true - } - ], - "responses": { - "400": { - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - }, - "x-nullable": true - } - } - } - }, - "/pet/{petId}": { - "get": { - "tags": [ - "Pet" - ], - "operationId": "Pet_FindById", - "parameters": [ - { - "type": "integer", - "name": "petId", - "in": "path", - "required": true, - "x-nullable": false, - "format": "int32" - } - ], - "responses": { - "400": { - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - }, - "x-nullable": true - }, - "404": { - "description": "" - } - } - }, - "post": { - "tags": [ - "Pet" - ], - "operationId": "Pet_EditPet2", - "parameters": [ - { - "type": "integer", - "name": "petId", - "in": "path", - "required": true, - "x-nullable": false, - "format": "int32" - }, - { - "type": "object", - "name": "pet", - "in": "formData", - "x-schema": { - "$ref": "#/definitions/Pet" - }, - "x-nullable": true - } - ], - "responses": { - "400": { - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - }, - "x-nullable": true - }, - "404": { - "description": "" - } - } - }, - "delete": { - "tags": [ - "Pet" - ], - "operationId": "Pet_DeletePet", - "parameters": [ - { - "type": "integer", - "name": "petId", - "in": "path", - "required": true, - "x-nullable": false, - "format": "int32" - } - ], - "responses": { - "400": { - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - }, - "x-nullable": true - }, - "404": { - "description": "" - } - } - } - }, - "/pet/{petId}/uploadImage": { - "post": { - "tags": [ - "Pet" - ], - "operationId": "Pet_UploadImage", - "consumes": [ - "multipart/form-data" - ], - "parameters": [ - { - "type": "integer", - "name": "petId", - "in": "path", - "required": true, - "x-nullable": false, - "format": "int32" - }, - { - "type": "file", - "name": "file", - "in": "formData", - "x-nullable": true - } - ], - "responses": { - "400": { - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - }, - "x-nullable": true - }, - "404": { - "description": "" - } - } - } - } - }, - "definitions": { - "Pet": { - "type": "object", - "additionalProperties": false, - "required": [ - "id", - "age", - "hasVaccinations", - "name", - "status" - ], - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "age": { - "type": "integer", - "format": "int32", - "maximum": 150.0, - "minimum": 0.0 - }, - "category": { - "$ref": "#/definitions/Category" - }, - "hasVaccinations": { - "type": "boolean" - }, - "name": { - "type": "string", - "maxLength": 50, - "minLength": 2 - }, - "images": { - "type": "array", - "items": { - "$ref": "#/definitions/Image" - } - }, - "tags": { - "type": "array", - "items": { - "$ref": "#/definitions/Tag" - } - }, - "status": { - "type": "string" - } - } - }, - "Category": { - "type": "object", - "additionalProperties": false, - "required": [ - "id" - ], - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "name": { - "type": "string" - } - } - }, - "Image": { - "type": "object", - "additionalProperties": false, - "required": [ - "id" - ], - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "url": { - "type": "string" - } - } - }, - "Tag": { - "type": "object", - "additionalProperties": false, - "required": [ - "id" - ], - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "name": { - "type": "string" - } - } - }, - "SerializableError": { - "type": "object", - "additionalProperties": false, - "allOf": [ - { - "type": "object", - "additionalProperties": {} - } - ] - } - }, - "parameters": {}, - "responses": {}, - "securityDefinitions": {} -} \ No newline at end of file diff --git a/src/NSwag.Sample.NETCore21/swagger.json b/src/NSwag.Sample.NETCore21/swagger.json deleted file mode 100644 index 663b26f9b5..0000000000 --- a/src/NSwag.Sample.NETCore21/swagger.json +++ /dev/null @@ -1,514 +0,0 @@ -{ - "x-generator": "NSwag v11.17.15.0 (NJsonSchema v9.10.53.0 (Newtonsoft.Json v10.0.0.0))", - "swagger": "2.0", - "info": { - "title": "My Title", - "version": "1.0.0" - }, - "host": "localhost:44370", - "schemes": [ - "https" - ], - "consumes": [ - "application/json", - "application/json-patch+json", - "text/json", - "application/*+json", - "multipart/form-data" - ], - "produces": [ - "application/json" - ], - "paths": { - "/pet": { - "post": { - "tags": [ - "Pet" - ], - "operationId": "Pet_AddPet", - "consumes": [ - "application/json" - ], - "parameters": [ - { - "name": "pet", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/Pet" - }, - "x-nullable": true - } - ], - "responses": { - "204": { - "description": "" - }, - "400": { - "x-nullable": true, - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - } - } - } - }, - "put": { - "tags": [ - "Pet" - ], - "operationId": "Pet_EditPet", - "consumes": [ - "application/json" - ], - "parameters": [ - { - "name": "pet", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/Pet" - }, - "x-nullable": true - } - ], - "responses": { - "204": { - "description": "" - }, - "400": { - "x-nullable": true, - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - } - } - } - } - }, - "/pet/findByStatus": { - "get": { - "tags": [ - "Pet" - ], - "operationId": "Pet_FindByStatus", - "consumes": [ - "application/json-patch+json", - "application/json", - "text/json", - "application/*+json" - ], - "parameters": [ - { - "name": "status", - "in": "body", - "required": true, - "schema": { - "type": "array", - "items": { - "type": "string" - } - }, - "x-nullable": true - } - ], - "responses": { - "200": { - "x-nullable": true, - "description": "", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/Pet" - } - } - } - } - } - }, - "/pet/findByCategory": { - "get": { - "tags": [ - "Pet" - ], - "operationId": "Pet_FindByCategory", - "parameters": [ - { - "type": "string", - "name": "category", - "in": "query", - "required": true, - "x-nullable": true - } - ], - "responses": { - "200": { - "x-nullable": true, - "description": "", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/Pet" - } - } - }, - "400": { - "x-nullable": true, - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - } - } - } - } - }, - "/pet/{petId}": { - "get": { - "tags": [ - "Pet" - ], - "operationId": "Pet_FindById", - "parameters": [ - { - "type": "integer", - "name": "petId", - "in": "path", - "required": true, - "format": "int32", - "x-nullable": false - } - ], - "responses": { - "200": { - "x-nullable": true, - "description": "", - "schema": { - "$ref": "#/definitions/Pet" - } - }, - "400": { - "x-nullable": true, - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - } - }, - "404": { - "description": "" - } - } - }, - "post": { - "tags": [ - "Pet" - ], - "operationId": "Pet_EditPet2", - "parameters": [ - { - "type": "integer", - "name": "petId", - "in": "path", - "required": true, - "format": "int32", - "x-nullable": false - }, - { - "type": "integer", - "name": "Id", - "in": "formData", - "required": true, - "format": "int32", - "x-nullable": false - }, - { - "type": "integer", - "name": "Age", - "in": "formData", - "required": true, - "format": "int32", - "x-nullable": false - }, - { - "type": "integer", - "name": "Category.Id", - "in": "formData", - "required": true, - "format": "int32", - "x-nullable": false - }, - { - "type": "string", - "name": "Category.Name", - "in": "formData", - "required": true, - "x-nullable": true - }, - { - "type": "boolean", - "name": "HasVaccinations", - "in": "formData", - "required": true, - "x-nullable": false - }, - { - "type": "string", - "name": "Name", - "in": "formData", - "required": true, - "x-nullable": true - }, - { - "type": "array", - "name": "Images", - "in": "formData", - "required": true, - "collectionFormat": "multi", - "x-nullable": true, - "items": { - "$ref": "#/definitions/Image" - } - }, - { - "type": "array", - "name": "Tags", - "in": "formData", - "required": true, - "collectionFormat": "multi", - "x-nullable": true, - "items": { - "$ref": "#/definitions/Tag" - } - }, - { - "type": "string", - "name": "Status", - "in": "formData", - "required": true, - "x-nullable": true - } - ], - "responses": { - "204": { - "description": "" - }, - "400": { - "x-nullable": true, - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - } - }, - "404": { - "description": "" - } - } - }, - "delete": { - "tags": [ - "Pet" - ], - "operationId": "Pet_DeletePet", - "parameters": [ - { - "type": "integer", - "name": "petId", - "in": "path", - "required": true, - "format": "int32", - "x-nullable": false - } - ], - "responses": { - "204": { - "description": "" - }, - "400": { - "x-nullable": true, - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - } - }, - "404": { - "description": "" - } - } - } - }, - "/pet/{petId}/uploadImage": { - "post": { - "tags": [ - "Pet" - ], - "operationId": "Pet_UploadImage", - "consumes": [ - "multipart/form-data" - ], - "parameters": [ - { - "type": "integer", - "name": "petId", - "in": "path", - "required": true, - "format": "int32", - "x-nullable": false - }, - { - "type": "file", - "name": "file", - "in": "formData", - "required": true, - "x-nullable": true - } - ], - "responses": { - "200": { - "x-nullable": true, - "description": "", - "schema": { - "$ref": "#/definitions/ApiResponse" - } - }, - "400": { - "x-nullable": true, - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - } - }, - "404": { - "description": "" - } - } - } - } - }, - "definitions": { - "Pet": { - "type": "object", - "additionalProperties": false, - "required": [ - "id", - "age", - "hasVaccinations", - "name", - "status" - ], - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "age": { - "type": "integer", - "format": "int32", - "maximum": 150.0, - "minimum": 0.0 - }, - "category": { - "$ref": "#/definitions/Category" - }, - "hasVaccinations": { - "type": "boolean" - }, - "name": { - "type": "string", - "maxLength": 50, - "minLength": 2 - }, - "images": { - "type": "array", - "items": { - "$ref": "#/definitions/Image" - } - }, - "tags": { - "type": "array", - "items": { - "$ref": "#/definitions/Tag" - } - }, - "status": { - "type": "string" - } - } - }, - "Category": { - "type": "object", - "additionalProperties": false, - "required": [ - "id" - ], - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "name": { - "type": "string" - } - } - }, - "Image": { - "type": "object", - "additionalProperties": false, - "required": [ - "id" - ], - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "url": { - "type": "string" - } - } - }, - "Tag": { - "type": "object", - "additionalProperties": false, - "required": [ - "id" - ], - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "name": { - "type": "string" - } - } - }, - "SerializableError": { - "type": "object", - "additionalProperties": false, - "allOf": [ - { - "type": "object", - "additionalProperties": {} - } - ] - }, - "ApiResponse": { - "type": "object", - "additionalProperties": false, - "required": [ - "code" - ], - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "message": { - "type": "string" - }, - "type": { - "type": "string" - } - } - } - } -} \ No newline at end of file diff --git a/src/NSwag.Sample.NETCore21/swagger_assembly_cli.json b/src/NSwag.Sample.NETCore21/swagger_assembly_cli.json deleted file mode 100644 index d118dea644..0000000000 --- a/src/NSwag.Sample.NETCore21/swagger_assembly_cli.json +++ /dev/null @@ -1,563 +0,0 @@ -{ - "x-generator": "NSwag v13.15.5.0 (NJsonSchema v10.6.6.0 (Newtonsoft.Json v11.0.0.0))", - "swagger": "2.0", - "info": { - "title": "ljlkjlkj", - "version": "1.0.0" - }, - "paths": { - "/pet/createOrder": { - "post": { - "tags": [ - "Pet" - ], - "summary": "Creates an order", - "operationId": "Pet_CreateOrder", - "produces": [ - "text/plain", - "application/json", - "text/json" - ], - "responses": { - "201": { - "x-nullable": false, - "description": "Order created", - "schema": { - "type": "integer", - "format": "int32" - } - }, - "400": { - "x-nullable": false, - "description": "Order invalid", - "schema": { - "type": "object", - "additionalProperties": { - "type": "string" - } - } - } - } - } - }, - "/pet": { - "post": { - "tags": [ - "Pet" - ], - "operationId": "Pet_AddPet", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "parameters": [ - { - "name": "pet", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/Pet" - }, - "x-nullable": false - } - ], - "responses": { - "204": { - "description": "My success response description." - }, - "400": { - "x-nullable": false, - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - } - } - } - }, - "put": { - "tags": [ - "Pet" - ], - "operationId": "Pet_EditPetPUT", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "parameters": [ - { - "name": "pet", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/Pet" - }, - "x-nullable": false - } - ], - "responses": { - "204": { - "description": "" - }, - "400": { - "x-nullable": false, - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - } - } - } - } - }, - "/pet/findByStatus": { - "get": { - "tags": [ - "Pet" - ], - "operationId": "Pet_FindByStatus", - "produces": [ - "application/json" - ], - "parameters": [ - { - "type": "array", - "name": "status", - "in": "query", - "required": true, - "collectionFormat": "multi", - "x-nullable": true, - "items": { - "type": "string" - } - } - ], - "responses": { - "200": { - "x-nullable": false, - "description": "", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/Pet" - } - } - } - } - } - }, - "/pet/findByCategory": { - "get": { - "tags": [ - "Pet" - ], - "operationId": "Pet_FindByCategory", - "produces": [ - "application/json" - ], - "parameters": [ - { - "type": "string", - "name": "category", - "in": "query", - "required": true, - "x-nullable": true - } - ], - "responses": { - "200": { - "x-nullable": false, - "description": "", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/Pet" - } - } - }, - "400": { - "x-nullable": false, - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - } - } - } - } - }, - "/pet/{petId}": { - "get": { - "tags": [ - "Pet" - ], - "operationId": "Pet_FindById", - "produces": [ - "application/json" - ], - "parameters": [ - { - "type": "integer", - "name": "petId", - "in": "path", - "required": true, - "format": "int32", - "x-nullable": false - } - ], - "responses": { - "200": { - "x-nullable": false, - "description": "", - "schema": { - "$ref": "#/definitions/Pet" - } - }, - "400": { - "x-nullable": false, - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - } - }, - "404": { - "description": "" - } - } - }, - "post": { - "tags": [ - "Pet" - ], - "operationId": "Pet_EditPetPOST", - "produces": [ - "application/json" - ], - "parameters": [ - { - "type": "integer", - "name": "petId", - "in": "path", - "required": true, - "format": "int32", - "x-nullable": false - }, - { - "type": "integer", - "name": "Id", - "in": "formData", - "required": true, - "format": "int32", - "x-nullable": false - }, - { - "type": "integer", - "name": "Age", - "in": "formData", - "required": true, - "format": "int32", - "maximum": 150.0, - "minimum": 0.0, - "x-nullable": false - }, - { - "type": "integer", - "name": "Category.Id", - "in": "formData", - "required": true, - "format": "int32", - "x-nullable": false - }, - { - "type": "string", - "name": "Category.Name", - "in": "formData", - "required": true, - "x-nullable": true - }, - { - "type": "boolean", - "name": "HasVaccinations", - "in": "formData", - "required": true, - "x-nullable": false - }, - { - "type": "string", - "name": "Name", - "in": "formData", - "required": true, - "maxLength": 50, - "minLength": 2, - "x-nullable": true - }, - { - "type": "array", - "name": "Images", - "in": "formData", - "required": true, - "collectionFormat": "multi", - "x-nullable": true, - "items": { - "$ref": "#/definitions/Image" - } - }, - { - "type": "array", - "name": "Tags", - "in": "formData", - "required": true, - "collectionFormat": "multi", - "x-nullable": true, - "items": { - "$ref": "#/definitions/Tag" - } - }, - { - "type": "string", - "name": "Status", - "in": "formData", - "required": true, - "x-nullable": true - } - ], - "responses": { - "204": { - "description": "" - }, - "400": { - "x-nullable": false, - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - } - }, - "404": { - "description": "" - } - } - }, - "delete": { - "tags": [ - "Pet" - ], - "operationId": "Pet_DeletePet", - "produces": [ - "application/json" - ], - "parameters": [ - { - "type": "integer", - "name": "petId", - "in": "path", - "required": true, - "format": "int32", - "x-nullable": false - } - ], - "responses": { - "204": { - "description": "" - }, - "400": { - "x-nullable": false, - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - } - }, - "404": { - "description": "" - } - } - } - }, - "/pet/{petId}/uploadImage": { - "post": { - "tags": [ - "Pet" - ], - "operationId": "Pet_UploadImage", - "consumes": [ - "multipart/form-data" - ], - "produces": [ - "application/json" - ], - "parameters": [ - { - "type": "integer", - "name": "petId", - "in": "path", - "required": true, - "format": "int32", - "x-nullable": false - }, - { - "type": "file", - "name": "file", - "in": "formData", - "required": true, - "x-nullable": true - } - ], - "responses": { - "200": { - "x-nullable": false, - "description": "", - "schema": { - "$ref": "#/definitions/ApiResponse" - } - }, - "400": { - "x-nullable": false, - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - } - }, - "404": { - "description": "" - } - } - } - }, - "/pet/file": { - "post": { - "tags": [ - "Pet" - ], - "operationId": "Pet_GetFile", - "responses": { - "200": { - "x-nullable": true, - "description": "", - "schema": { - "type": "file" - } - } - } - } - } - }, - "definitions": { - "SerializableError": { - "type": "object", - "description": "Defines a serializable container for storing ModelState information.\nThis information is stored as key/value pairs.", - "additionalProperties": {} - }, - "Pet": { - "type": "object", - "required": [ - "id", - "age", - "hasVaccinations", - "name", - "status" - ], - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "age": { - "type": "integer", - "format": "int32", - "maximum": 150.0, - "minimum": 0.0 - }, - "category": { - "$ref": "#/definitions/Category" - }, - "hasVaccinations": { - "type": "boolean" - }, - "name": { - "type": "string", - "maxLength": 50, - "minLength": 2 - }, - "images": { - "type": "array", - "items": { - "$ref": "#/definitions/Image" - } - }, - "tags": { - "type": "array", - "items": { - "$ref": "#/definitions/Tag" - } - }, - "status": { - "type": "string", - "minLength": 1 - } - } - }, - "Category": { - "type": "object", - "required": [ - "id" - ], - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "name": { - "type": "string" - } - } - }, - "Image": { - "type": "object", - "required": [ - "id" - ], - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "url": { - "type": "string" - } - } - }, - "Tag": { - "type": "object", - "required": [ - "id" - ], - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "name": { - "type": "string" - } - } - }, - "ApiResponse": { - "type": "object", - "required": [ - "code" - ], - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "message": { - "type": "string" - }, - "type": { - "type": "string" - } - } - } - } -} \ No newline at end of file diff --git a/src/NSwag.Sample.NETCore21/swagger_project_cli.json b/src/NSwag.Sample.NETCore21/swagger_project_cli.json deleted file mode 100644 index 0b1425bbfa..0000000000 --- a/src/NSwag.Sample.NETCore21/swagger_project_cli.json +++ /dev/null @@ -1,562 +0,0 @@ -{ - "x-generator": "NSwag v13.15.4.0 (NJsonSchema v10.6.5.0 (Newtonsoft.Json v11.0.0.0))", - "swagger": "2.0", - "info": { - "title": "My Title", - "version": "1.0.0" - }, - "paths": { - "/pet/createOrder": { - "post": { - "tags": [ - "Pet" - ], - "summary": "Creates an order", - "operationId": "Pet_CreateOrder", - "produces": [ - "text/plain", - "application/json", - "text/json" - ], - "responses": { - "201": { - "x-nullable": false, - "description": "Order created", - "schema": { - "type": "integer", - "format": "int32" - } - }, - "400": { - "x-nullable": false, - "description": "Order invalid", - "schema": { - "type": "object", - "additionalProperties": { - "type": "string" - } - } - } - } - } - }, - "/pet": { - "post": { - "tags": [ - "Pet" - ], - "operationId": "Pet_AddPet", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "parameters": [ - { - "name": "pet", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/Pet" - }, - "x-nullable": false - } - ], - "responses": { - "204": { - "description": "My success response description." - }, - "400": { - "x-nullable": false, - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - } - } - } - }, - "put": { - "tags": [ - "Pet" - ], - "operationId": "Pet_EditPetPUT", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "parameters": [ - { - "name": "pet", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/Pet" - }, - "x-nullable": false - } - ], - "responses": { - "204": { - "description": "" - }, - "400": { - "x-nullable": false, - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - } - } - } - } - }, - "/pet/findByStatus": { - "get": { - "tags": [ - "Pet" - ], - "operationId": "Pet_FindByStatus", - "produces": [ - "application/json" - ], - "parameters": [ - { - "type": "array", - "name": "status", - "in": "query", - "required": true, - "collectionFormat": "multi", - "x-nullable": true, - "items": { - "type": "string" - } - } - ], - "responses": { - "200": { - "x-nullable": false, - "description": "", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/Pet" - } - } - } - } - } - }, - "/pet/findByCategory": { - "get": { - "tags": [ - "Pet" - ], - "operationId": "Pet_FindByCategory", - "produces": [ - "application/json" - ], - "parameters": [ - { - "type": "string", - "name": "category", - "in": "query", - "required": true, - "x-nullable": true - } - ], - "responses": { - "200": { - "x-nullable": false, - "description": "", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/Pet" - } - } - }, - "400": { - "x-nullable": false, - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - } - } - } - } - }, - "/pet/{petId}": { - "get": { - "tags": [ - "Pet" - ], - "operationId": "Pet_FindById", - "produces": [ - "application/json" - ], - "parameters": [ - { - "type": "integer", - "name": "petId", - "in": "path", - "required": true, - "format": "int32", - "x-nullable": false - } - ], - "responses": { - "200": { - "x-nullable": false, - "description": "", - "schema": { - "$ref": "#/definitions/Pet" - } - }, - "400": { - "x-nullable": false, - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - } - }, - "404": { - "description": "" - } - } - }, - "post": { - "tags": [ - "Pet" - ], - "operationId": "Pet_EditPetPOST", - "produces": [ - "application/json" - ], - "parameters": [ - { - "type": "integer", - "name": "petId", - "in": "path", - "required": true, - "format": "int32", - "x-nullable": false - }, - { - "type": "integer", - "name": "Id", - "in": "formData", - "required": true, - "format": "int32", - "x-nullable": false - }, - { - "type": "integer", - "name": "Age", - "in": "formData", - "required": true, - "format": "int32", - "maximum": 150.0, - "minimum": 0.0, - "x-nullable": false - }, - { - "type": "integer", - "name": "Category.Id", - "in": "formData", - "required": true, - "format": "int32", - "x-nullable": false - }, - { - "type": "string", - "name": "Category.Name", - "in": "formData", - "required": true, - "x-nullable": true - }, - { - "type": "boolean", - "name": "HasVaccinations", - "in": "formData", - "required": true, - "x-nullable": false - }, - { - "type": "string", - "name": "Name", - "in": "formData", - "required": true, - "maxLength": 50, - "minLength": 2, - "x-nullable": true - }, - { - "type": "array", - "name": "Images", - "in": "formData", - "required": true, - "collectionFormat": "multi", - "x-nullable": true, - "items": { - "$ref": "#/definitions/Image" - } - }, - { - "type": "array", - "name": "Tags", - "in": "formData", - "required": true, - "collectionFormat": "multi", - "x-nullable": true, - "items": { - "$ref": "#/definitions/Tag" - } - }, - { - "type": "string", - "name": "Status", - "in": "formData", - "required": true, - "x-nullable": true - } - ], - "responses": { - "204": { - "description": "" - }, - "400": { - "x-nullable": false, - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - } - }, - "404": { - "description": "" - } - } - }, - "delete": { - "tags": [ - "Pet" - ], - "operationId": "Pet_DeletePet", - "produces": [ - "application/json" - ], - "parameters": [ - { - "type": "integer", - "name": "petId", - "in": "path", - "required": true, - "format": "int32", - "x-nullable": false - } - ], - "responses": { - "204": { - "description": "" - }, - "400": { - "x-nullable": false, - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - } - }, - "404": { - "description": "" - } - } - } - }, - "/pet/{petId}/uploadImage": { - "post": { - "tags": [ - "Pet" - ], - "operationId": "Pet_UploadImage", - "consumes": [ - "multipart/form-data" - ], - "produces": [ - "application/json" - ], - "parameters": [ - { - "type": "integer", - "name": "petId", - "in": "path", - "required": true, - "format": "int32", - "x-nullable": false - }, - { - "type": "file", - "name": "file", - "in": "formData", - "required": true, - "x-nullable": true - } - ], - "responses": { - "200": { - "x-nullable": false, - "description": "", - "schema": { - "$ref": "#/definitions/ApiResponse" - } - }, - "400": { - "x-nullable": false, - "description": "", - "schema": { - "$ref": "#/definitions/SerializableError" - } - }, - "404": { - "description": "" - } - } - } - }, - "/pet/file": { - "post": { - "tags": [ - "Pet" - ], - "operationId": "Pet_GetFile", - "responses": { - "200": { - "x-nullable": true, - "description": "", - "schema": { - "type": "file" - } - } - } - } - } - }, - "definitions": { - "SerializableError": { - "type": "object", - "additionalProperties": {} - }, - "Pet": { - "type": "object", - "required": [ - "id", - "age", - "hasVaccinations", - "name", - "status" - ], - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "age": { - "type": "integer", - "format": "int32", - "maximum": 150.0, - "minimum": 0.0 - }, - "category": { - "$ref": "#/definitions/Category" - }, - "hasVaccinations": { - "type": "boolean" - }, - "name": { - "type": "string", - "maxLength": 50, - "minLength": 2 - }, - "images": { - "type": "array", - "items": { - "$ref": "#/definitions/Image" - } - }, - "tags": { - "type": "array", - "items": { - "$ref": "#/definitions/Tag" - } - }, - "status": { - "type": "string", - "minLength": 1 - } - } - }, - "Category": { - "type": "object", - "required": [ - "id" - ], - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "name": { - "type": "string" - } - } - }, - "Image": { - "type": "object", - "required": [ - "id" - ], - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "url": { - "type": "string" - } - } - }, - "Tag": { - "type": "object", - "required": [ - "id" - ], - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "name": { - "type": "string" - } - } - }, - "ApiResponse": { - "type": "object", - "required": [ - "code" - ], - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "message": { - "type": "string" - }, - "type": { - "type": "string" - } - } - } - } -} \ No newline at end of file diff --git a/src/NSwag.Sample.NETCore31/Controllers/ValuesController.cs b/src/NSwag.Sample.NETCore31/Controllers/ValuesController.cs deleted file mode 100644 index a2607c63ce..0000000000 --- a/src/NSwag.Sample.NETCore31/Controllers/ValuesController.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using System.Collections.Generic; -using Microsoft.AspNetCore.Mvc; - -namespace NSwag.Sample.NETCore31.Controllers -{ - [Route("api/[controller]")] - [ApiController] - public class ValuesController : ControllerBase - { - public class Person - { - public string FirstName { get; set; } = ""; - - public string? MiddleName { get; set; } - - public string LastName { get; set; } = ""; - - public DateTime DayOfBirth { get; set; } - } - - public enum TestEnum - { - Foo, - Bar - } - - [HttpGet] - public ActionResult> Get() - { - return new Person[] { }; - } - - // GET api/values/5 - [HttpGet("{id}")] - public ActionResult Get(int id) - { - return TestEnum.Foo; - } - - // GET api/values/5 - [HttpGet("{id}/foo")] - public ActionResult GetFooBar(int id) - { - return "value"; - } - - // POST api/values - [HttpPost] - public void Post([FromBody] string value) - { - } - - // PUT api/values/5 - [HttpPut("{id}")] - public void Put(int id, [FromBody] string value) - { - } - - // DELETE api/values/5 - [HttpDelete("{id}")] - public void Delete(int id) - { - } - } -} diff --git a/src/NSwag.Sample.NETCore31/NSwag.Sample.NETCore31.csproj b/src/NSwag.Sample.NETCore31/NSwag.Sample.NETCore31.csproj deleted file mode 100644 index 8989d13892..0000000000 --- a/src/NSwag.Sample.NETCore31/NSwag.Sample.NETCore31.csproj +++ /dev/null @@ -1,17 +0,0 @@ - - - - netcoreapp3.1 - enable - 8.0 - - - - - - - - - - - diff --git a/src/NSwag.Sample.NETCore31/Program.cs b/src/NSwag.Sample.NETCore31/Program.cs deleted file mode 100644 index 9a09ac918e..0000000000 --- a/src/NSwag.Sample.NETCore31/Program.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.Hosting; - -namespace NSwag.Sample.NETCore31 -{ - public class Program - { - public static void Main(string[] args) - { - CreateHostBuilder(args).Build().Run(); - } - - public static IHostBuilder CreateHostBuilder(string[] args) => - Host.CreateDefaultBuilder(args) - .ConfigureWebHostDefaults(webBuilder => - { - webBuilder.UseStartup(); - }); - } -} diff --git a/src/NSwag.Sample.NETCore31/Properties/launchSettings.json b/src/NSwag.Sample.NETCore31/Properties/launchSettings.json deleted file mode 100644 index 51a0293a3c..0000000000 --- a/src/NSwag.Sample.NETCore31/Properties/launchSettings.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:51340", - "sslPort": 44379 - } - }, - "$schema": "http://json.schemastore.org/launchsettings.json", - "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "launchUrl": "swagger", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "NSwag.Sample.NETCore31": { - "commandName": "Project", - "launchBrowser": true, - "launchUrl": "apimundo", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - }, - "applicationUrl": "https://localhost:7001;http://localhost:7000" - } - } -} \ No newline at end of file diff --git a/src/NSwag.Sample.NETCore31/Startup.cs b/src/NSwag.Sample.NETCore31/Startup.cs deleted file mode 100644 index db396e7764..0000000000 --- a/src/NSwag.Sample.NETCore31/Startup.cs +++ /dev/null @@ -1,60 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; -using Newtonsoft.Json.Converters; -using NJsonSchema.Generation; - -namespace NSwag.Sample.NETCore31 -{ - public class Startup - { - public Startup(IConfiguration configuration) - { - Configuration = configuration; - } - - public IConfiguration Configuration { get; } - - public void ConfigureServices(IServiceCollection services) - { - services.AddMvc(); - - services - .AddControllers() - .AddNewtonsoftJson(options => options.SerializerSettings.Converters.Add(new StringEnumConverter())); - - services.AddOpenApiDocument(document => - { - document.Description = "Hello world!"; - document.DefaultReferenceTypeNullHandling = ReferenceTypeNullHandling.NotNull; - }); - } - - public void Configure(IApplicationBuilder app, IWebHostEnvironment env) - { - if (env.IsDevelopment()) - { - app.UseDeveloperExceptionPage(); - } - - app.UseHttpsRedirection(); - app.UseRouting(); - app.UseAuthorization(); - app.UseEndpoints(endpoints => - { - endpoints.MapControllers(); - }); - - app.UseOpenApi(); - app.UseSwaggerUi3(); - //app.UseApimundo(); - app.UseApimundo(settings => - { - //settings.CompareTo = "a:a:27:25:15:latest"; - settings.ApimundoUrl = "https://localhost:5001"; - }); - } - } -} diff --git a/src/NSwag.Sample.NETCore31/appsettings.Development.json b/src/NSwag.Sample.NETCore31/appsettings.Development.json deleted file mode 100644 index e203e9407e..0000000000 --- a/src/NSwag.Sample.NETCore31/appsettings.Development.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Debug", - "System": "Information", - "Microsoft": "Information" - } - } -} diff --git a/src/NSwag.Sample.NETCore31/appsettings.json b/src/NSwag.Sample.NETCore31/appsettings.json deleted file mode 100644 index 7cb5ac8193..0000000000 --- a/src/NSwag.Sample.NETCore31/appsettings.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Warning", - "Microsoft.Hosting.Lifetime": "Information" - } - }, - "AllowedHosts": "*" -} diff --git a/src/NSwag.Sample.NETCore31/nswag.json b/src/NSwag.Sample.NETCore31/nswag.json deleted file mode 100644 index 74d1e2d7ff..0000000000 --- a/src/NSwag.Sample.NETCore31/nswag.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "runtime": "NetCore31", - "defaultVariables": null, - "documentGenerator": { - "aspNetCoreToOpenApi": { - "project": "NSwag.Sample.NETCore31.csproj", - "msBuildProjectExtensionsPath": null, - "configuration": null, - "runtime": null, - "targetFramework": null, - "noBuild": false, - "verbose": true, - "workingDirectory": null, - "requireParametersWithoutDefault": false, - "apiGroupNames": null, - "defaultPropertyNameHandling": "Default", - "defaultReferenceTypeNullHandling": "Null", - "defaultDictionaryValueReferenceTypeNullHandling": "NotNull", - "defaultResponseReferenceTypeNullHandling": "NotNull", - "defaultEnumHandling": "Integer", - "flattenInheritanceHierarchy": false, - "generateKnownTypes": true, - "generateEnumMappingDescription": false, - "generateXmlObjects": false, - "generateAbstractProperties": false, - "generateAbstractSchemas": true, - "ignoreObsoleteProperties": false, - "allowReferencesWithProperties": false, - "excludedTypeNames": [], - "serviceHost": null, - "serviceBasePath": null, - "serviceSchemes": [], - "infoTitle": "My Title", - "infoDescription": null, - "infoVersion": "1.0.0", - "documentTemplate": null, - "documentProcessorTypes": [], - "operationProcessorTypes": [], - "typeNameGeneratorType": null, - "schemaNameGeneratorType": null, - "contractResolverType": null, - "serializerSettingsType": null, - "useDocumentProvider": true, - "documentName": "v1", - "aspNetCoreEnvironment": null, - "createWebHostBuilderMethod": null, - "startupType": null, - "allowNullableBodyParameters": true, - "output": "openapi.json", - "outputType": "Swagger2", - "assemblyPaths": [], - "assemblyConfig": null, - "referencePaths": [], - "useNuGetCache": false - } - }, - "codeGenerators": {} -} \ No newline at end of file diff --git a/src/NSwag.Sample.NETCore31/openapi.json b/src/NSwag.Sample.NETCore31/openapi.json deleted file mode 100644 index b056765f37..0000000000 --- a/src/NSwag.Sample.NETCore31/openapi.json +++ /dev/null @@ -1,215 +0,0 @@ -{ - "x-generator": "NSwag v13.15.5.0 (NJsonSchema v10.6.6.0 (Newtonsoft.Json v12.0.0.0))", - "openapi": "3.0.0", - "info": { - "title": "My Title", - "description": "Hello world!", - "version": "1.0.0" - }, - "paths": { - "/api/Values": { - "get": { - "tags": [ - "Values" - ], - "operationId": "Values_GetAll", - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Person" - } - } - } - } - } - } - }, - "post": { - "tags": [ - "Values" - ], - "operationId": "Values_Post", - "requestBody": { - "x-name": "value", - "content": { - "application/json": { - "schema": { - "type": "string" - } - } - }, - "required": true, - "x-position": 1 - }, - "responses": { - "200": { - "description": "" - } - } - } - }, - "/api/Values/{id}": { - "get": { - "tags": [ - "Values" - ], - "operationId": "Values_Get", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - }, - "x-position": 1 - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/TestEnum" - } - } - } - } - } - }, - "put": { - "tags": [ - "Values" - ], - "operationId": "Values_Put", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - }, - "x-position": 1 - } - ], - "requestBody": { - "x-name": "value", - "content": { - "application/json": { - "schema": { - "type": "string" - } - } - }, - "required": true, - "x-position": 2 - }, - "responses": { - "200": { - "description": "" - } - } - }, - "delete": { - "tags": [ - "Values" - ], - "operationId": "Values_Delete", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - }, - "x-position": 1 - } - ], - "responses": { - "200": { - "description": "" - } - } - } - }, - "/api/Values/{id}/foo": { - "get": { - "tags": [ - "Values" - ], - "operationId": "Values_GetFooBar", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - }, - "x-position": 1 - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "type": "string" - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Person": { - "type": "object", - "additionalProperties": false, - "properties": { - "firstName": { - "type": "string" - }, - "middleName": { - "type": "string", - "nullable": true - }, - "lastName": { - "type": "string" - }, - "dayOfBirth": { - "type": "string", - "format": "date-time" - } - } - }, - "TestEnum": { - "type": "string", - "description": "", - "x-enumNames": [ - "Foo", - "Bar" - ], - "enum": [ - "Foo", - "Bar" - ] - } - } - } -} \ No newline at end of file diff --git a/src/NSwag.Sample.NetCoreAngular.Clients/NSwag.Sample.NetCoreAngular.Clients.csproj b/src/NSwag.Sample.NetCoreAngular.Clients/NSwag.Sample.NetCoreAngular.Clients.csproj index e416a6758e..7ddab2614c 100644 --- a/src/NSwag.Sample.NetCoreAngular.Clients/NSwag.Sample.NetCoreAngular.Clients.csproj +++ b/src/NSwag.Sample.NetCoreAngular.Clients/NSwag.Sample.NetCoreAngular.Clients.csproj @@ -1,7 +1,7 @@  - netstandard1.4 + netstandard2.0 diff --git a/src/NSwag.Sample.NetCoreAngular/NSwag.Sample.NetCoreAngular.csproj b/src/NSwag.Sample.NetCoreAngular/NSwag.Sample.NetCoreAngular.csproj index 74aaad7d20..775e9daabe 100644 --- a/src/NSwag.Sample.NetCoreAngular/NSwag.Sample.NetCoreAngular.csproj +++ b/src/NSwag.Sample.NetCoreAngular/NSwag.Sample.NetCoreAngular.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1 + net6.0 true false @@ -9,6 +9,7 @@ + diff --git a/src/NSwag.Sample.NetCoreAngular/Startup.cs b/src/NSwag.Sample.NetCoreAngular/Startup.cs index b6e0b9760a..a373bf58f2 100644 --- a/src/NSwag.Sample.NetCoreAngular/Startup.cs +++ b/src/NSwag.Sample.NetCoreAngular/Startup.cs @@ -30,10 +30,18 @@ public Startup(IHostingEnvironment env) public void ConfigureServices(IServiceCollection services) { // Add framework services. - services.AddMvc().AddJsonOptions(o => + services + .AddMvc() + .AddNewtonsoftJson(o => + { + o.SerializerSettings.PreserveReferencesHandling = PreserveReferencesHandling.Objects; + o.SerializerSettings.Converters = new List { new StringEnumConverter() }; + }); + + services.AddLogging(o => { - o.SerializerSettings.PreserveReferencesHandling = PreserveReferencesHandling.Objects; - o.SerializerSettings.Converters = new List { new StringEnumConverter() }; + o.AddConsole(); + o.AddDebug(); }); services.AddSwaggerDocument(); @@ -48,9 +56,6 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF .AllowAnyHeader() .WithExposedHeaders("content-disposition", "content-type")); - loggerFactory.AddConsole(Configuration.GetSection("Logging")); - loggerFactory.AddDebug(); - app.UseSwaggerUi3(); if (env.IsDevelopment()) diff --git a/src/NSwag.Sample.NetCoreAngular/nswag.json b/src/NSwag.Sample.NetCoreAngular/nswag.json index a7f8d5a0bd..3c273113b5 100644 --- a/src/NSwag.Sample.NetCoreAngular/nswag.json +++ b/src/NSwag.Sample.NetCoreAngular/nswag.json @@ -19,7 +19,7 @@ "infoVersion": "1.0.0", "output": "swagger.json", "assemblyPaths": [ - "bin/Debug/netcoreapp3.1/NSwag.Sample.NetCoreAngular.dll" + "bin/Debug/net6.0/NSwag.Sample.NetCoreAngular.dll" ], "referencePaths": [] } diff --git a/src/NSwag.Sample.NetCoreAurelia/NSwag.Sample.NetCoreAurelia.csproj b/src/NSwag.Sample.NetCoreAurelia/NSwag.Sample.NetCoreAurelia.csproj index 29f3d24928..93ad6e8f5c 100644 --- a/src/NSwag.Sample.NetCoreAurelia/NSwag.Sample.NetCoreAurelia.csproj +++ b/src/NSwag.Sample.NetCoreAurelia/NSwag.Sample.NetCoreAurelia.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1 + net6.0 true false @@ -11,7 +11,8 @@ - + + diff --git a/src/NSwag.Sample.NetCoreAurelia/Startup.cs b/src/NSwag.Sample.NetCoreAurelia/Startup.cs index f8615caf25..fdd8e1c6f4 100644 --- a/src/NSwag.Sample.NetCoreAurelia/Startup.cs +++ b/src/NSwag.Sample.NetCoreAurelia/Startup.cs @@ -1,17 +1,16 @@ -using System.Reflection; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.SpaServices.Webpack; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; -using NSwag.AspNetCore; namespace NSwag_Sample_NetCoreAurelia { public class Startup { - public Startup(IHostingEnvironment env) + public Startup(IWebHostEnvironment env) { var builder = new ConfigurationBuilder() .SetBasePath(env.ContentRootPath) @@ -27,12 +26,17 @@ public Startup(IHostingEnvironment env) public void ConfigureServices(IServiceCollection services) { // Add framework services. - services.AddMvc(); + services.AddMvc(o => o.EnableEndpointRouting = true); services.AddSwaggerDocument(); + services.AddLogging(o => + { + o.AddConsole(); + o.AddDebug(); + }); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) + public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory) { app.UseCors(builder => builder .WithOrigins("*") @@ -40,9 +44,6 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF .AllowAnyHeader() .WithExposedHeaders("content-disposition", "content-type")); - loggerFactory.AddConsole(Configuration.GetSection("Logging")); - loggerFactory.AddDebug(); - app.UseSwaggerUi3(); if (env.IsDevelopment()) diff --git a/src/NSwag.Sample.NetCoreAurelia/nswag.json b/src/NSwag.Sample.NetCoreAurelia/nswag.json index 2fec75cacb..33b4c37387 100644 --- a/src/NSwag.Sample.NetCoreAurelia/nswag.json +++ b/src/NSwag.Sample.NetCoreAurelia/nswag.json @@ -21,7 +21,7 @@ "infoVersion": "1.0.0", "output": null, "assemblyPaths": [ - "bin/Debug/netcoreapp3.1/NSwag.Sample.NetCoreAurelia.dll" + "bin/Debug/net6.0/NSwag.Sample.NetCoreAurelia.dll" ], "referencePaths": [] } diff --git a/src/NSwag.Sample.NetGlobalAsax/NSwag.Sample.NetGlobalAsax.csproj b/src/NSwag.Sample.NetGlobalAsax/NSwag.Sample.NetGlobalAsax.csproj index 026a029808..5be2f13c0a 100644 --- a/src/NSwag.Sample.NetGlobalAsax/NSwag.Sample.NetGlobalAsax.csproj +++ b/src/NSwag.Sample.NetGlobalAsax/NSwag.Sample.NetGlobalAsax.csproj @@ -14,7 +14,7 @@ NSwag.Sample.NetGlobalAsax NSwag.Sample.NetGlobalAsax win - v4.6.1 + v4.6.2 false true diff --git a/src/NSwag.VersionMissmatchTest/App.config b/src/NSwag.VersionMissmatchTest/App.config index 3a16ba8580..a068fd13fb 100644 --- a/src/NSwag.VersionMissmatchTest/App.config +++ b/src/NSwag.VersionMissmatchTest/App.config @@ -1,7 +1,7 @@ - + diff --git a/src/NSwag.VersionMissmatchTest/NSwag.VersionMissmatchTest.csproj b/src/NSwag.VersionMissmatchTest/NSwag.VersionMissmatchTest.csproj index 8d79872a0b..ae3d1f8874 100644 --- a/src/NSwag.VersionMissmatchTest/NSwag.VersionMissmatchTest.csproj +++ b/src/NSwag.VersionMissmatchTest/NSwag.VersionMissmatchTest.csproj @@ -2,7 +2,7 @@ Exe - net461 + net462 win true diff --git a/src/NSwag.sln b/src/NSwag.sln index a0a43ddb0f..db11d72d2d 100644 --- a/src/NSwag.sln +++ b/src/NSwag.sln @@ -136,10 +136,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NSwag.AspNetCore.Launcher.x EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NSwag.Core.Tests", "NSwag.Core.Tests\NSwag.Core.Tests.csproj", "{810AF444-D713-4CEE-BC9F-13D7875AE69B}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NSwag.Sample.NETCore21", "NSwag.Sample.NETCore21\NSwag.Sample.NETCore21.csproj", "{B60E7723-91F4-412B-9EB3-4050B71B0DAA}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NSwag.Sample.NET50", "NSwag.Sample.NET50\NSwag.Sample.NET50.csproj", "{F109D48B-A2FF-497D-8374-FEA60C5F2365}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NSwag.Generation.AspNetCore.Tests.Web", "NSwag.Generation.AspNetCore.Tests.Web\NSwag.Generation.AspNetCore.Tests.Web.csproj", "{FDD41017-91E2-4BD8-B827-F851BDEC6B6E}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NSwag.AssemblyLoader.Tests", "NSwag.AssemblyLoader.Tests\NSwag.AssemblyLoader.Tests.csproj", "{1853262B-6D39-477B-872A-8B5473FE74BB}" @@ -154,18 +150,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NSwag.Core.Yaml.Tests", "NS EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NSwag.Generation.Tests", "NSwag.Generation.Tests\NSwag.Generation.Tests.csproj", "{F237A592-2D74-4C38-B222-2C91029B87F8}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NSwag.Sample.NETCore31", "NSwag.Sample.NETCore31\NSwag.Sample.NETCore31.csproj", "{4BCF42CE-A289-4B6D-92DB-ED95F8ED4B19}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "00 Build", "00 Build", "{6F5E4FDF-0A82-42D5-94AC-A9CD43CC931D}" ProjectSection(SolutionItems) = preProject ..\azure-pipelines.yml = ..\azure-pipelines.yml Directory.Build.props = Directory.Build.props EndProjectSection EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NSwag.Sample.NETCore20", "NSwag.Sample.NETCore20\NSwag.Sample.NETCore20.csproj", "{37563171-4C09-4BCD-B2FB-08F786198909}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NSwag.Sample.NETCore20.Part", "NSwag.Sample.NETCore20.Part\NSwag.Sample.NETCore20.Part.csproj", "{60438B13-8111-44C3-B5E5-34C3F30FF234}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "_build", "..\build\_build.csproj", "{AC3D8125-AE21-49FC-A217-D96C7B585FF9}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NSwag.Sample.NET60", "NSwag.Sample.NET60\NSwag.Sample.NET60.csproj", "{DE82965A-6935-43E0-A9A1-F3F35B4487EB}" @@ -872,42 +862,6 @@ Global {810AF444-D713-4CEE-BC9F-13D7875AE69B}.ReleaseTypeScriptStrict|x64.Build.0 = Release|Any CPU {810AF444-D713-4CEE-BC9F-13D7875AE69B}.ReleaseTypeScriptStrict|x86.ActiveCfg = Release|Any CPU {810AF444-D713-4CEE-BC9F-13D7875AE69B}.ReleaseTypeScriptStrict|x86.Build.0 = Release|Any CPU - {B60E7723-91F4-412B-9EB3-4050B71B0DAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B60E7723-91F4-412B-9EB3-4050B71B0DAA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B60E7723-91F4-412B-9EB3-4050B71B0DAA}.Debug|x64.ActiveCfg = Debug|Any CPU - {B60E7723-91F4-412B-9EB3-4050B71B0DAA}.Debug|x64.Build.0 = Debug|Any CPU - {B60E7723-91F4-412B-9EB3-4050B71B0DAA}.Debug|x86.ActiveCfg = Debug|Any CPU - {B60E7723-91F4-412B-9EB3-4050B71B0DAA}.Debug|x86.Build.0 = Debug|Any CPU - {B60E7723-91F4-412B-9EB3-4050B71B0DAA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B60E7723-91F4-412B-9EB3-4050B71B0DAA}.Release|Any CPU.Build.0 = Release|Any CPU - {B60E7723-91F4-412B-9EB3-4050B71B0DAA}.Release|x64.ActiveCfg = Release|Any CPU - {B60E7723-91F4-412B-9EB3-4050B71B0DAA}.Release|x64.Build.0 = Release|Any CPU - {B60E7723-91F4-412B-9EB3-4050B71B0DAA}.Release|x86.ActiveCfg = Release|Any CPU - {B60E7723-91F4-412B-9EB3-4050B71B0DAA}.Release|x86.Build.0 = Release|Any CPU - {B60E7723-91F4-412B-9EB3-4050B71B0DAA}.ReleaseTypeScriptStrict|Any CPU.ActiveCfg = Release|Any CPU - {B60E7723-91F4-412B-9EB3-4050B71B0DAA}.ReleaseTypeScriptStrict|Any CPU.Build.0 = Release|Any CPU - {B60E7723-91F4-412B-9EB3-4050B71B0DAA}.ReleaseTypeScriptStrict|x64.ActiveCfg = Release|Any CPU - {B60E7723-91F4-412B-9EB3-4050B71B0DAA}.ReleaseTypeScriptStrict|x64.Build.0 = Release|Any CPU - {B60E7723-91F4-412B-9EB3-4050B71B0DAA}.ReleaseTypeScriptStrict|x86.ActiveCfg = Release|Any CPU - {B60E7723-91F4-412B-9EB3-4050B71B0DAA}.ReleaseTypeScriptStrict|x86.Build.0 = Release|Any CPU - {F109D48B-A2FF-497D-8374-FEA60C5F2365}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F109D48B-A2FF-497D-8374-FEA60C5F2365}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F109D48B-A2FF-497D-8374-FEA60C5F2365}.Debug|x64.ActiveCfg = Debug|Any CPU - {F109D48B-A2FF-497D-8374-FEA60C5F2365}.Debug|x64.Build.0 = Debug|Any CPU - {F109D48B-A2FF-497D-8374-FEA60C5F2365}.Debug|x86.ActiveCfg = Debug|Any CPU - {F109D48B-A2FF-497D-8374-FEA60C5F2365}.Debug|x86.Build.0 = Debug|Any CPU - {F109D48B-A2FF-497D-8374-FEA60C5F2365}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F109D48B-A2FF-497D-8374-FEA60C5F2365}.Release|Any CPU.Build.0 = Release|Any CPU - {F109D48B-A2FF-497D-8374-FEA60C5F2365}.Release|x64.ActiveCfg = Release|Any CPU - {F109D48B-A2FF-497D-8374-FEA60C5F2365}.Release|x64.Build.0 = Release|Any CPU - {F109D48B-A2FF-497D-8374-FEA60C5F2365}.Release|x86.ActiveCfg = Release|Any CPU - {F109D48B-A2FF-497D-8374-FEA60C5F2365}.Release|x86.Build.0 = Release|Any CPU - {F109D48B-A2FF-497D-8374-FEA60C5F2365}.ReleaseTypeScriptStrict|Any CPU.ActiveCfg = Release|Any CPU - {F109D48B-A2FF-497D-8374-FEA60C5F2365}.ReleaseTypeScriptStrict|Any CPU.Build.0 = Release|Any CPU - {F109D48B-A2FF-497D-8374-FEA60C5F2365}.ReleaseTypeScriptStrict|x64.ActiveCfg = Release|Any CPU - {F109D48B-A2FF-497D-8374-FEA60C5F2365}.ReleaseTypeScriptStrict|x64.Build.0 = Release|Any CPU - {F109D48B-A2FF-497D-8374-FEA60C5F2365}.ReleaseTypeScriptStrict|x86.ActiveCfg = Release|Any CPU - {F109D48B-A2FF-497D-8374-FEA60C5F2365}.ReleaseTypeScriptStrict|x86.Build.0 = Release|Any CPU {FDD41017-91E2-4BD8-B827-F851BDEC6B6E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FDD41017-91E2-4BD8-B827-F851BDEC6B6E}.Debug|Any CPU.Build.0 = Debug|Any CPU {FDD41017-91E2-4BD8-B827-F851BDEC6B6E}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -980,60 +934,6 @@ Global {F237A592-2D74-4C38-B222-2C91029B87F8}.ReleaseTypeScriptStrict|x64.Build.0 = Release|Any CPU {F237A592-2D74-4C38-B222-2C91029B87F8}.ReleaseTypeScriptStrict|x86.ActiveCfg = Release|Any CPU {F237A592-2D74-4C38-B222-2C91029B87F8}.ReleaseTypeScriptStrict|x86.Build.0 = Release|Any CPU - {4BCF42CE-A289-4B6D-92DB-ED95F8ED4B19}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4BCF42CE-A289-4B6D-92DB-ED95F8ED4B19}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4BCF42CE-A289-4B6D-92DB-ED95F8ED4B19}.Debug|x64.ActiveCfg = Debug|Any CPU - {4BCF42CE-A289-4B6D-92DB-ED95F8ED4B19}.Debug|x64.Build.0 = Debug|Any CPU - {4BCF42CE-A289-4B6D-92DB-ED95F8ED4B19}.Debug|x86.ActiveCfg = Debug|Any CPU - {4BCF42CE-A289-4B6D-92DB-ED95F8ED4B19}.Debug|x86.Build.0 = Debug|Any CPU - {4BCF42CE-A289-4B6D-92DB-ED95F8ED4B19}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4BCF42CE-A289-4B6D-92DB-ED95F8ED4B19}.Release|Any CPU.Build.0 = Release|Any CPU - {4BCF42CE-A289-4B6D-92DB-ED95F8ED4B19}.Release|x64.ActiveCfg = Release|Any CPU - {4BCF42CE-A289-4B6D-92DB-ED95F8ED4B19}.Release|x64.Build.0 = Release|Any CPU - {4BCF42CE-A289-4B6D-92DB-ED95F8ED4B19}.Release|x86.ActiveCfg = Release|Any CPU - {4BCF42CE-A289-4B6D-92DB-ED95F8ED4B19}.Release|x86.Build.0 = Release|Any CPU - {4BCF42CE-A289-4B6D-92DB-ED95F8ED4B19}.ReleaseTypeScriptStrict|Any CPU.ActiveCfg = Release|Any CPU - {4BCF42CE-A289-4B6D-92DB-ED95F8ED4B19}.ReleaseTypeScriptStrict|Any CPU.Build.0 = Release|Any CPU - {4BCF42CE-A289-4B6D-92DB-ED95F8ED4B19}.ReleaseTypeScriptStrict|x64.ActiveCfg = Release|Any CPU - {4BCF42CE-A289-4B6D-92DB-ED95F8ED4B19}.ReleaseTypeScriptStrict|x64.Build.0 = Release|Any CPU - {4BCF42CE-A289-4B6D-92DB-ED95F8ED4B19}.ReleaseTypeScriptStrict|x86.ActiveCfg = Release|Any CPU - {4BCF42CE-A289-4B6D-92DB-ED95F8ED4B19}.ReleaseTypeScriptStrict|x86.Build.0 = Release|Any CPU - {37563171-4C09-4BCD-B2FB-08F786198909}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {37563171-4C09-4BCD-B2FB-08F786198909}.Debug|Any CPU.Build.0 = Debug|Any CPU - {37563171-4C09-4BCD-B2FB-08F786198909}.Debug|x64.ActiveCfg = Debug|Any CPU - {37563171-4C09-4BCD-B2FB-08F786198909}.Debug|x64.Build.0 = Debug|Any CPU - {37563171-4C09-4BCD-B2FB-08F786198909}.Debug|x86.ActiveCfg = Debug|Any CPU - {37563171-4C09-4BCD-B2FB-08F786198909}.Debug|x86.Build.0 = Debug|Any CPU - {37563171-4C09-4BCD-B2FB-08F786198909}.Release|Any CPU.ActiveCfg = Release|Any CPU - {37563171-4C09-4BCD-B2FB-08F786198909}.Release|Any CPU.Build.0 = Release|Any CPU - {37563171-4C09-4BCD-B2FB-08F786198909}.Release|x64.ActiveCfg = Release|Any CPU - {37563171-4C09-4BCD-B2FB-08F786198909}.Release|x64.Build.0 = Release|Any CPU - {37563171-4C09-4BCD-B2FB-08F786198909}.Release|x86.ActiveCfg = Release|Any CPU - {37563171-4C09-4BCD-B2FB-08F786198909}.Release|x86.Build.0 = Release|Any CPU - {37563171-4C09-4BCD-B2FB-08F786198909}.ReleaseTypeScriptStrict|Any CPU.ActiveCfg = Release|Any CPU - {37563171-4C09-4BCD-B2FB-08F786198909}.ReleaseTypeScriptStrict|Any CPU.Build.0 = Release|Any CPU - {37563171-4C09-4BCD-B2FB-08F786198909}.ReleaseTypeScriptStrict|x64.ActiveCfg = Release|Any CPU - {37563171-4C09-4BCD-B2FB-08F786198909}.ReleaseTypeScriptStrict|x64.Build.0 = Release|Any CPU - {37563171-4C09-4BCD-B2FB-08F786198909}.ReleaseTypeScriptStrict|x86.ActiveCfg = Release|Any CPU - {37563171-4C09-4BCD-B2FB-08F786198909}.ReleaseTypeScriptStrict|x86.Build.0 = Release|Any CPU - {60438B13-8111-44C3-B5E5-34C3F30FF234}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {60438B13-8111-44C3-B5E5-34C3F30FF234}.Debug|Any CPU.Build.0 = Debug|Any CPU - {60438B13-8111-44C3-B5E5-34C3F30FF234}.Debug|x64.ActiveCfg = Debug|Any CPU - {60438B13-8111-44C3-B5E5-34C3F30FF234}.Debug|x64.Build.0 = Debug|Any CPU - {60438B13-8111-44C3-B5E5-34C3F30FF234}.Debug|x86.ActiveCfg = Debug|Any CPU - {60438B13-8111-44C3-B5E5-34C3F30FF234}.Debug|x86.Build.0 = Debug|Any CPU - {60438B13-8111-44C3-B5E5-34C3F30FF234}.Release|Any CPU.ActiveCfg = Release|Any CPU - {60438B13-8111-44C3-B5E5-34C3F30FF234}.Release|Any CPU.Build.0 = Release|Any CPU - {60438B13-8111-44C3-B5E5-34C3F30FF234}.Release|x64.ActiveCfg = Release|Any CPU - {60438B13-8111-44C3-B5E5-34C3F30FF234}.Release|x64.Build.0 = Release|Any CPU - {60438B13-8111-44C3-B5E5-34C3F30FF234}.Release|x86.ActiveCfg = Release|Any CPU - {60438B13-8111-44C3-B5E5-34C3F30FF234}.Release|x86.Build.0 = Release|Any CPU - {60438B13-8111-44C3-B5E5-34C3F30FF234}.ReleaseTypeScriptStrict|Any CPU.ActiveCfg = Release|Any CPU - {60438B13-8111-44C3-B5E5-34C3F30FF234}.ReleaseTypeScriptStrict|Any CPU.Build.0 = Release|Any CPU - {60438B13-8111-44C3-B5E5-34C3F30FF234}.ReleaseTypeScriptStrict|x64.ActiveCfg = Release|Any CPU - {60438B13-8111-44C3-B5E5-34C3F30FF234}.ReleaseTypeScriptStrict|x64.Build.0 = Release|Any CPU - {60438B13-8111-44C3-B5E5-34C3F30FF234}.ReleaseTypeScriptStrict|x86.ActiveCfg = Release|Any CPU - {60438B13-8111-44C3-B5E5-34C3F30FF234}.ReleaseTypeScriptStrict|x86.Build.0 = Release|Any CPU {AC3D8125-AE21-49FC-A217-D96C7B585FF9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AC3D8125-AE21-49FC-A217-D96C7B585FF9}.Debug|x64.ActiveCfg = Debug|Any CPU {AC3D8125-AE21-49FC-A217-D96C7B585FF9}.Debug|x86.ActiveCfg = Debug|Any CPU @@ -1162,16 +1062,11 @@ Global {B715070B-E76E-4959-894A-623EB7639E5F} = {F0F26A35-C4B6-42D0-A1DF-98CA46A5C560} {E90E9C77-7983-40D0-AAB3-91D16DC639CE} = {F0F26A35-C4B6-42D0-A1DF-98CA46A5C560} {810AF444-D713-4CEE-BC9F-13D7875AE69B} = {634E4ABD-29EC-4EB2-81EF-7E41D6D6F6E0} - {B60E7723-91F4-412B-9EB3-4050B71B0DAA} = {D8CC0D1C-8DAC-49FE-AA78-C028DC124DD5} - {F109D48B-A2FF-497D-8374-FEA60C5F2365} = {D8CC0D1C-8DAC-49FE-AA78-C028DC124DD5} {FDD41017-91E2-4BD8-B827-F851BDEC6B6E} = {634E4ABD-29EC-4EB2-81EF-7E41D6D6F6E0} {1853262B-6D39-477B-872A-8B5473FE74BB} = {634E4ABD-29EC-4EB2-81EF-7E41D6D6F6E0} {E6E40935-0C79-480B-BF29-8C493AC7E518} = {DDBB05AC-B066-48C4-933C-034F401EBB6A} {B6467D5A-7B13-4B06-89BE-2BC7B6615956} = {634E4ABD-29EC-4EB2-81EF-7E41D6D6F6E0} {F237A592-2D74-4C38-B222-2C91029B87F8} = {634E4ABD-29EC-4EB2-81EF-7E41D6D6F6E0} - {4BCF42CE-A289-4B6D-92DB-ED95F8ED4B19} = {D8CC0D1C-8DAC-49FE-AA78-C028DC124DD5} - {37563171-4C09-4BCD-B2FB-08F786198909} = {D8CC0D1C-8DAC-49FE-AA78-C028DC124DD5} - {60438B13-8111-44C3-B5E5-34C3F30FF234} = {D8CC0D1C-8DAC-49FE-AA78-C028DC124DD5} {AC3D8125-AE21-49FC-A217-D96C7B585FF9} = {6F5E4FDF-0A82-42D5-94AC-A9CD43CC931D} {DE82965A-6935-43E0-A9A1-F3F35B4487EB} = {D8CC0D1C-8DAC-49FE-AA78-C028DC124DD5} {24693FBC-445E-4360-A1E8-B6F136C563FB} = {D8CC0D1C-8DAC-49FE-AA78-C028DC124DD5} diff --git a/src/NSwagStudio/App.config b/src/NSwagStudio/App.config index 57b0b8bb1f..a5cce42e99 100644 --- a/src/NSwagStudio/App.config +++ b/src/NSwagStudio/App.config @@ -1,7 +1,7 @@  - + diff --git a/src/NSwagStudio/NSwagStudio.csproj b/src/NSwagStudio/NSwagStudio.csproj index 126c510ff6..36270ef3ea 100644 --- a/src/NSwagStudio/NSwagStudio.csproj +++ b/src/NSwagStudio/NSwagStudio.csproj @@ -1,7 +1,7 @@  WinExe - net461 + net462 {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} true true diff --git a/src/NSwagStudio/nswag.cmd b/src/NSwagStudio/nswag.cmd index ed0aa436ec..14a94050f9 100644 --- a/src/NSwagStudio/nswag.cmd +++ b/src/NSwagStudio/nswag.cmd @@ -6,23 +6,13 @@ IF NOT "%args:/runtime:winx86=%" == "%args%" ( GOTO end ) -IF NOT "%args:/runtime:netcore21=%" == "%args%" ( - dotnet "%~dp0/NetCore21/dotnet-nswag.dll" %* - GOTO end -) - -IF NOT "%args:/runtime:netcore31=%" == "%args%" ( - dotnet "%~dp0/NetCore31/dotnet-nswag.dll" %* - GOTO end -) - -IF NOT "%args:/runtime:net50=%" == "%args%" ( - dotnet "%~dp0/Net50/dotnet-nswag.dll" %* +IF NOT "%args:/runtime:net60=%" == "%args%" ( + dotnet "%~dp0/Net60/dotnet-nswag.dll" %* GOTO end ) -IF NOT "%args:/runtime:net60=%" == "%args%" ( - dotnet "%~dp0/Net60/dotnet-nswag.dll" %* +IF NOT "%args:/runtime:net70=%" == "%args%" ( + dotnet "%~dp0/Net70/dotnet-nswag.dll" %* GOTO end )