Skip to content

Commit

Permalink
Fix NSwag config
Browse files Browse the repository at this point in the history
  • Loading branch information
giovanninocco committed Oct 22, 2023
1 parent 2b471ee commit 55bbd43
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/template/scripts/add-update-db-migrations.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ param(
)

$rootDirectory = git rev-parse --show-toplevel
$hostDirectory = $rootDirectory + '/src/Host'
$hostDirectory = $rootDirectory + '/src/WebApi'
Set-Location -Path $hostDirectory
Write-Host "Host Directory is $hostDirectory `n"

Expand Down Expand Up @@ -44,7 +44,7 @@ $hangfireJsonContent.HangfireSettings.Storage.ConnectionString = $mssqlConnectio
$hangfireJsonContent | ConvertTo-Json | set-content $hangfireJsonPath

Write-Host "Adding Migrations for MSSQL Provider..."
dotnet ef migrations add $commitMessage --project .././Migrators/Migrators.MSSQL/ --context ApplicationDbContext -o Migrations/Application
dotnet ef migrations add $commitMessage --project ../Migrators/Migrators.MSSQL/ --context ApplicationDbContext -o Migrations/Application
Write-Host "Adding Migrations for MSSQL Provider...Done`n"
Write-Host "**************************`n"

Expand All @@ -59,7 +59,7 @@ $hangfireJsonContent.HangfireSettings.Storage.ConnectionString = $mysqlConnectio
$hangfireJsonContent | ConvertTo-Json | set-content $hangfireJsonPath

Write-Host "Adding Migrations for MySQL Provider..."
dotnet ef migrations add $commitMessage --project .././Migrators/Migrators.MySQL/ --context ApplicationDbContext -o Migrations/Application
dotnet ef migrations add $commitMessage --project ../Migrators/Migrators.MySQL/ --context ApplicationDbContext -o Migrations/Application
Write-Host "Adding Migrations for MySQL Provider...Done`n"
Write-Host "**************************`n"

Expand All @@ -74,7 +74,7 @@ $hangfireJsonContent.HangfireSettings.Storage.ConnectionString = $postgresqlConn
$hangfireJsonContent | ConvertTo-Json | set-content $hangfireJsonPath

Write-Host "Adding Migrations for PostgreSQL Provider..."
dotnet ef migrations add $commitMessage --project .././Migrators/Migrators.PostgreSQL/ --context ApplicationDbContext -o Migrations/Application
dotnet ef migrations add $commitMessage --project ../Migrators/Migrators.PostgreSQL/ --context ApplicationDbContext -o Migrations/Application
Write-Host "Adding Migrations for PostgreSQL Provider...Done`n"
Write-Host "**************************`n"

Expand Down
2 changes: 1 addition & 1 deletion src/template/scripts/delete-workflow-runs.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
org=genocs
org=Genocs
repo=microservice-template
workflow_id=12524751 #add in your workflow id here.
echo "Listing runs for the workflow ID $workflow_id"
Expand Down
14 changes: 10 additions & 4 deletions src/template/scripts/nswag-regen.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,21 @@

$currentDirectory = Get-Location
$rootDirectory = git rev-parse --show-toplevel
$hostDirectory = Join-Path -Path $rootDirectory -ChildPath 'src/Host'
$infrastructurePrj = Join-Path -Path $rootDirectory -ChildPath 'src/Client.Infrastructure/Client.Infrastructure.csproj'

# use relative path to the template folder
$templateFolder = ''
# $templateFolder = 'src/template/'


$webApiDirectory = Join-Path -Path $rootDirectory -ChildPath $templateFolder'src/WebApi'
$infrastructurePrj = Join-Path -Path $rootDirectory -ChildPath $templateFolder'src/Infrastructure/Infrastructure.csproj'

Write-Host "Make sure you have run the Genocs.WebApi project. `n"
Write-Host "Press any key to continue... `n"
$null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown');

Set-Location -Path $hostDirectory
Write-Host "Host Directory is $hostDirectory `n"
Set-Location -Path $webApiDirectory
Write-Host "WebApi Directory is $webApiDirectory `n"

<# Run command #>
dotnet build -t:NSwag $infrastructurePrj
Expand Down
1 change: 1 addition & 0 deletions src/template/src/Infrastructure/Infrastructure.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<IsPackable>false</IsPackable>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<RootNamespace>Genocs.Microservice.Template.Infrastructure</RootNamespace>
<AssemblyName>Genocs.Microservice.Template.Infrastructure</AssemblyName>
</PropertyGroup>
Expand Down
13 changes: 13 additions & 0 deletions src/template/src/Infrastructure/OpenApi/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,12 @@ internal static IApplicationBuilder UseOpenApiDocumentation(this IApplicationBui
{
if (config.GetValue<bool>("SwaggerSettings:Enable"))
{
// Add OpenAPI 3.0 document serving middleware
// Available at: https://{root}/swagger/v1/swagger.json
app.UseOpenApi();

// Add web UIs to interact with the document
// Available at: http://{root}/swagger
app.UseSwaggerUi3(options =>
{
options.DefaultModelsExpandDepth = -1;
Expand All @@ -130,6 +135,14 @@ internal static IApplicationBuilder UseOpenApiDocumentation(this IApplicationBui
options.OAuth2Client.Scopes.Add(config["SecuritySettings:Swagger:ApiScope"]);
}
});

// TODO: Add Swagger ReDoc UI configuration settings
// Add ReDoc UI to interact with the document
// Available at: http://{root}/redoc
app.UseReDoc(options =>
{
options.Path = "/redoc";
});
}

return app;
Expand Down

0 comments on commit 55bbd43

Please sign in to comment.