From fc01832ad4f61ace7101d149198d6ebf2a1a57e0 Mon Sep 17 00:00:00 2001 From: Brady Gaster Date: Fri, 17 Apr 2020 00:04:37 -0700 Subject: [PATCH 1/9] added Cosmos dependencies to project --- .../COVIDScreeningApi/COVIDScreeningApi.csproj | 3 +++ .../COVIDScreeningApi/Program.cs | 8 ++++++++ .../Properties/launchSettings.json | 14 +++++++++++--- .../Properties/serviceDependencies.json | 12 ++++++++++++ .../Properties/serviceDependencies.local.json | 16 ++++++++++++++++ 5 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 Start/COVIDScreeningApi/COVIDScreeningApi/Properties/serviceDependencies.json create mode 100644 Start/COVIDScreeningApi/COVIDScreeningApi/Properties/serviceDependencies.local.json diff --git a/Start/COVIDScreeningApi/COVIDScreeningApi/COVIDScreeningApi.csproj b/Start/COVIDScreeningApi/COVIDScreeningApi/COVIDScreeningApi.csproj index 9e59f36..a5abf7a 100644 --- a/Start/COVIDScreeningApi/COVIDScreeningApi/COVIDScreeningApi.csproj +++ b/Start/COVIDScreeningApi/COVIDScreeningApi/COVIDScreeningApi.csproj @@ -7,6 +7,9 @@ + + + diff --git a/Start/COVIDScreeningApi/COVIDScreeningApi/Program.cs b/Start/COVIDScreeningApi/COVIDScreeningApi/Program.cs index 8cbc3b5..9b6b915 100644 --- a/Start/COVIDScreeningApi/COVIDScreeningApi/Program.cs +++ b/Start/COVIDScreeningApi/COVIDScreeningApi/Program.cs @@ -6,6 +6,7 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; +using Azure.Identity; namespace COVIDScreeningApi { @@ -18,6 +19,13 @@ public static void Main(string[] args) public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) +.ConfigureAppConfiguration((context, config) => +{ +var keyVaultEndpoint = new Uri(Environment.GetEnvironmentVariable("VaultUri")); +config.AddAzureKeyVault( +keyVaultEndpoint, +new DefaultAzureCredential()); +}) .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup(); diff --git a/Start/COVIDScreeningApi/COVIDScreeningApi/Properties/launchSettings.json b/Start/COVIDScreeningApi/COVIDScreeningApi/Properties/launchSettings.json index 466f185..9b07177 100644 --- a/Start/COVIDScreeningApi/COVIDScreeningApi/Properties/launchSettings.json +++ b/Start/COVIDScreeningApi/COVIDScreeningApi/Properties/launchSettings.json @@ -14,7 +14,9 @@ "launchBrowser": true, "launchUrl": "weatherforecast", "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" + "ASPNETCORE_ENVIRONMENT": "Development", + "VaultUri": "https://covid-api-vault.vault.azure.net/", + "AZURE_USERNAME": "bradyg@microsoft.com" } }, "COVIDScreeningApi": { @@ -22,7 +24,9 @@ "launchBrowser": true, "launchUrl": "weatherforecast", "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" + "ASPNETCORE_ENVIRONMENT": "Development", + "VaultUri": "https://covid-api-vault.vault.azure.net/", + "AZURE_USERNAME": "bradyg@microsoft.com" }, "applicationUrl": "https://localhost:5001;http://localhost:5000" }, @@ -31,7 +35,11 @@ "launchBrowser": true, "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/weatherforecast", "publishAllPorts": true, - "useSSL": true + "useSSL": true, + "environmentVariables": { + "VaultUri": "https://covid-api-vault.vault.azure.net/", + "AZURE_USERNAME": "bradyg@microsoft.com" + } } } } \ No newline at end of file diff --git a/Start/COVIDScreeningApi/COVIDScreeningApi/Properties/serviceDependencies.json b/Start/COVIDScreeningApi/COVIDScreeningApi/Properties/serviceDependencies.json new file mode 100644 index 0000000..a05b61a --- /dev/null +++ b/Start/COVIDScreeningApi/COVIDScreeningApi/Properties/serviceDependencies.json @@ -0,0 +1,12 @@ +{ + "dependencies": { + "secrets1": { + "type": "secrets", + "connectionId": "VaultUri" + }, + "cosmosdb1": { + "type": "cosmosdb", + "connectionId": "covid-screening-db" + } + } +} \ No newline at end of file diff --git a/Start/COVIDScreeningApi/COVIDScreeningApi/Properties/serviceDependencies.local.json b/Start/COVIDScreeningApi/COVIDScreeningApi/Properties/serviceDependencies.local.json new file mode 100644 index 0000000..0596c91 --- /dev/null +++ b/Start/COVIDScreeningApi/COVIDScreeningApi/Properties/serviceDependencies.local.json @@ -0,0 +1,16 @@ +{ + "dependencies": { + "secrets1": { + "resourceId": "/subscriptions/[parameters('subscriptionId')]/resourceGroups/[parameters('resourceGroup')]/providers/Microsoft.KeyVault/vaults/covid-api-vault", + "type": "secrets.keyVault", + "connectionId": "VaultUri", + "secretStore": null + }, + "cosmosdb1": { + "resourceId": "/subscriptions/[parameters('subscriptionId')]/resourceGroups/[parameters('resourceGroup')]/providers/Microsoft.DocumentDB/databaseAccounts/covid-screening-data", + "type": "cosmosdb.azure", + "connectionId": "covid-screening-db", + "secretStore": "AzureKeyVault" + } + } +} \ No newline at end of file From 0ca531271fb736821d3cb0dc79894ea7714fd2b9 Mon Sep 17 00:00:00 2001 From: Brady Gaster Date: Fri, 17 Apr 2020 00:12:33 -0700 Subject: [PATCH 2/9] added swagger support --- .../COVIDScreeningApi/COVIDScreeningApi.csproj | 1 + .../COVIDScreeningApi/Properties/launchSettings.json | 4 ++-- Start/COVIDScreeningApi/COVIDScreeningApi/Startup.cs | 11 +++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Start/COVIDScreeningApi/COVIDScreeningApi/COVIDScreeningApi.csproj b/Start/COVIDScreeningApi/COVIDScreeningApi/COVIDScreeningApi.csproj index a5abf7a..3fb72af 100644 --- a/Start/COVIDScreeningApi/COVIDScreeningApi/COVIDScreeningApi.csproj +++ b/Start/COVIDScreeningApi/COVIDScreeningApi/COVIDScreeningApi.csproj @@ -11,6 +11,7 @@ + diff --git a/Start/COVIDScreeningApi/COVIDScreeningApi/Properties/launchSettings.json b/Start/COVIDScreeningApi/COVIDScreeningApi/Properties/launchSettings.json index 9b07177..06ad9f4 100644 --- a/Start/COVIDScreeningApi/COVIDScreeningApi/Properties/launchSettings.json +++ b/Start/COVIDScreeningApi/COVIDScreeningApi/Properties/launchSettings.json @@ -12,7 +12,7 @@ "IIS Express": { "commandName": "IISExpress", "launchBrowser": true, - "launchUrl": "weatherforecast", + "launchUrl": "swagger/v1/swagger.json", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development", "VaultUri": "https://covid-api-vault.vault.azure.net/", @@ -22,7 +22,7 @@ "COVIDScreeningApi": { "commandName": "Project", "launchBrowser": true, - "launchUrl": "weatherforecast", + "launchUrl": "swagger/v1/swagger.json", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development", "VaultUri": "https://covid-api-vault.vault.azure.net/", diff --git a/Start/COVIDScreeningApi/COVIDScreeningApi/Startup.cs b/Start/COVIDScreeningApi/COVIDScreeningApi/Startup.cs index 95bceaf..68fae26 100644 --- a/Start/COVIDScreeningApi/COVIDScreeningApi/Startup.cs +++ b/Start/COVIDScreeningApi/COVIDScreeningApi/Startup.cs @@ -10,6 +10,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; +using Microsoft.OpenApi.Models; namespace COVIDScreeningApi { @@ -26,6 +27,14 @@ public Startup(IConfiguration configuration) public void ConfigureServices(IServiceCollection services) { services.AddControllers(); + services.AddSwaggerGen(config => + { + config.SwaggerDoc("v1", new OpenApiInfo + { + Title = "COVIDScreeningApi", + Version = "v1" + }); + }); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. @@ -42,6 +51,8 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) app.UseAuthorization(); + app.UseSwagger(); + app.UseEndpoints(endpoints => { endpoints.MapControllers(); From 99284185a48c77dc7787ac9b415131c5b31d93d4 Mon Sep 17 00:00:00 2001 From: Brady Gaster Date: Fri, 17 Apr 2020 00:36:10 -0700 Subject: [PATCH 3/9] removed delete apis --- .../COVIDScreeningApi/Controllers/PortsOfEntryController.cs | 6 ------ .../Controllers/RepresentativeDataController.cs | 6 ------ .../Controllers/ScreeningDataTableController.cs | 6 ------ 3 files changed, 18 deletions(-) diff --git a/Start/COVIDScreeningApi/COVIDScreeningApi/Controllers/PortsOfEntryController.cs b/Start/COVIDScreeningApi/COVIDScreeningApi/Controllers/PortsOfEntryController.cs index fb3c5fe..bc92757 100644 --- a/Start/COVIDScreeningApi/COVIDScreeningApi/Controllers/PortsOfEntryController.cs +++ b/Start/COVIDScreeningApi/COVIDScreeningApi/Controllers/PortsOfEntryController.cs @@ -38,11 +38,5 @@ public void Post([FromBody] PortsOfEntry value) public void Put(int id, [FromBody] PortsOfEntry value) { } - - // DELETE api//5 - [HttpDelete("{id}")] - public void Delete(int id) - { - } } } diff --git a/Start/COVIDScreeningApi/COVIDScreeningApi/Controllers/RepresentativeDataController.cs b/Start/COVIDScreeningApi/COVIDScreeningApi/Controllers/RepresentativeDataController.cs index 3cb54de..ef1014d 100644 --- a/Start/COVIDScreeningApi/COVIDScreeningApi/Controllers/RepresentativeDataController.cs +++ b/Start/COVIDScreeningApi/COVIDScreeningApi/Controllers/RepresentativeDataController.cs @@ -38,11 +38,5 @@ public void Post([FromBody] RepresentativeData value) public void Put(int id, [FromBody] RepresentativeData value) { } - - // DELETE api//5 - [HttpDelete("{id}")] - public void Delete(int id) - { - } } } diff --git a/Start/COVIDScreeningApi/COVIDScreeningApi/Controllers/ScreeningDataTableController.cs b/Start/COVIDScreeningApi/COVIDScreeningApi/Controllers/ScreeningDataTableController.cs index 163273c..b30d7f1 100644 --- a/Start/COVIDScreeningApi/COVIDScreeningApi/Controllers/ScreeningDataTableController.cs +++ b/Start/COVIDScreeningApi/COVIDScreeningApi/Controllers/ScreeningDataTableController.cs @@ -38,11 +38,5 @@ public void Post([FromBody] ScreeningDataTable value) public void Put(int id, [FromBody] ScreeningDataTable value) { } - - // DELETE api//5 - [HttpDelete("{id}")] - public void Delete(int id) - { - } } } From f26b293e6129a2a142925d191299ca501dda75cc Mon Sep 17 00:00:00 2001 From: Brady Gaster Date: Fri, 17 Apr 2020 01:05:28 -0700 Subject: [PATCH 4/9] fixed api paths by removing "api" from them --- .../COVIDScreeningApi/Controllers/PortsOfEntryController.cs | 2 +- .../Controllers/RepresentativeDataController.cs | 2 +- .../Controllers/ScreeningDataTableController.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Start/COVIDScreeningApi/COVIDScreeningApi/Controllers/PortsOfEntryController.cs b/Start/COVIDScreeningApi/COVIDScreeningApi/Controllers/PortsOfEntryController.cs index bc92757..f17f20b 100644 --- a/Start/COVIDScreeningApi/COVIDScreeningApi/Controllers/PortsOfEntryController.cs +++ b/Start/COVIDScreeningApi/COVIDScreeningApi/Controllers/PortsOfEntryController.cs @@ -9,7 +9,7 @@ namespace COVIDScreeningApi.Controllers { - [Route("api/[controller]")] + [Route("[controller]")] [ApiController] public class PortsOfEntryController : ControllerBase { diff --git a/Start/COVIDScreeningApi/COVIDScreeningApi/Controllers/RepresentativeDataController.cs b/Start/COVIDScreeningApi/COVIDScreeningApi/Controllers/RepresentativeDataController.cs index ef1014d..14f6126 100644 --- a/Start/COVIDScreeningApi/COVIDScreeningApi/Controllers/RepresentativeDataController.cs +++ b/Start/COVIDScreeningApi/COVIDScreeningApi/Controllers/RepresentativeDataController.cs @@ -9,7 +9,7 @@ namespace COVIDScreeningApi.Controllers { - [Route("api/[controller]")] + [Route("[controller]")] [ApiController] public class RepresentativeDataController : ControllerBase { diff --git a/Start/COVIDScreeningApi/COVIDScreeningApi/Controllers/ScreeningDataTableController.cs b/Start/COVIDScreeningApi/COVIDScreeningApi/Controllers/ScreeningDataTableController.cs index b30d7f1..465a719 100644 --- a/Start/COVIDScreeningApi/COVIDScreeningApi/Controllers/ScreeningDataTableController.cs +++ b/Start/COVIDScreeningApi/COVIDScreeningApi/Controllers/ScreeningDataTableController.cs @@ -9,7 +9,7 @@ namespace COVIDScreeningApi.Controllers { - [Route("api/[controller]")] + [Route("[controller]")] [ApiController] public class ScreeningDataTableController : ControllerBase { From a4bcd260170c5826424c54e0735f38a230557fa4 Mon Sep 17 00:00:00 2001 From: Brady Gaster Date: Fri, 17 Apr 2020 01:18:48 -0700 Subject: [PATCH 5/9] configured the swagger api so it would output the right host so debugging is easier --- .../Controllers/PortsOfEntryController.cs | 10 ++++++- .../DefaultWebHostNameDocumentFilter.cs | 29 +++++++++++++++++++ .../COVIDScreeningApi/Startup.cs | 1 + .../COVIDScreeningApi/appsettings.json | 3 +- 4 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 Start/COVIDScreeningApi/COVIDScreeningApi/DefaultWebHostNameDocumentFilter.cs diff --git a/Start/COVIDScreeningApi/COVIDScreeningApi/Controllers/PortsOfEntryController.cs b/Start/COVIDScreeningApi/COVIDScreeningApi/Controllers/PortsOfEntryController.cs index f17f20b..0fb8e15 100644 --- a/Start/COVIDScreeningApi/COVIDScreeningApi/Controllers/PortsOfEntryController.cs +++ b/Start/COVIDScreeningApi/COVIDScreeningApi/Controllers/PortsOfEntryController.cs @@ -17,7 +17,15 @@ public class PortsOfEntryController : ControllerBase [HttpGet] public IEnumerable Get() { - return new List(); + return new List(new PortsOfEntry[] + { + new PortsOfEntry { ItemsLabels = "Peace Arch Border", ItemsLatitudes = 49.001453, ItemsLongitudes = -122.736694}, + new PortsOfEntry { ItemsLabels = "Jefferson County International Airport", ItemsLatitudes = 48.108032, ItemsLongitudes = -122.774895}, + new PortsOfEntry { ItemsLabels = "Fairfield International Airport", ItemsLatitudes = 48.116325, ItemsLongitudes = -123.493484}, + new PortsOfEntry { ItemsLabels = "Grant County International Airport", ItemsLatitudes = 47.189873, ItemsLongitudes = -119.323608}, + new PortsOfEntry { ItemsLabels = "Spokane International Airport", ItemsLatitudes = 47.625526, ItemsLongitudes = -117.536163}, + new PortsOfEntry { ItemsLabels = "Seattle Airport", ItemsLatitudes = 47.443760, ItemsLongitudes = -122.302202}, + }); } // GET api//5 diff --git a/Start/COVIDScreeningApi/COVIDScreeningApi/DefaultWebHostNameDocumentFilter.cs b/Start/COVIDScreeningApi/COVIDScreeningApi/DefaultWebHostNameDocumentFilter.cs new file mode 100644 index 0000000..6423c53 --- /dev/null +++ b/Start/COVIDScreeningApi/COVIDScreeningApi/DefaultWebHostNameDocumentFilter.cs @@ -0,0 +1,29 @@ +using Microsoft.Extensions.Configuration; +using Microsoft.OpenApi.Models; +using Swashbuckle.AspNetCore.SwaggerGen; +using System.Collections.Generic; + +namespace COVIDScreeningApi +{ + internal class DefaultWebHostNameDocumentFilter : IDocumentFilter + { + public DefaultWebHostNameDocumentFilter(IConfiguration configuration) + { + Configuration = configuration; + } + + public IConfiguration Configuration { get; } + + public void Apply(OpenApiDocument swaggerDoc, + DocumentFilterContext context) + { + swaggerDoc.Servers = new List() + { + new OpenApiServer() + { + Url = Configuration["SwaggerBaseUrl"] + } + }; + } + } +} \ No newline at end of file diff --git a/Start/COVIDScreeningApi/COVIDScreeningApi/Startup.cs b/Start/COVIDScreeningApi/COVIDScreeningApi/Startup.cs index 68fae26..69f0fde 100644 --- a/Start/COVIDScreeningApi/COVIDScreeningApi/Startup.cs +++ b/Start/COVIDScreeningApi/COVIDScreeningApi/Startup.cs @@ -29,6 +29,7 @@ public void ConfigureServices(IServiceCollection services) services.AddControllers(); services.AddSwaggerGen(config => { + config.DocumentFilter(Configuration); config.SwaggerDoc("v1", new OpenApiInfo { Title = "COVIDScreeningApi", diff --git a/Start/COVIDScreeningApi/COVIDScreeningApi/appsettings.json b/Start/COVIDScreeningApi/COVIDScreeningApi/appsettings.json index 81ff877..e99e944 100644 --- a/Start/COVIDScreeningApi/COVIDScreeningApi/appsettings.json +++ b/Start/COVIDScreeningApi/COVIDScreeningApi/appsettings.json @@ -6,5 +6,6 @@ "Microsoft.Hosting.Lifetime": "Information" } }, - "AllowedHosts": "*" + "AllowedHosts": "*", + "SwaggerBaseUrl": "https://localhost:44354" } From 1c8832c11ef392278e1fb376c41c0a1dc79536bf Mon Sep 17 00:00:00 2001 From: Brady Gaster Date: Fri, 17 Apr 2020 01:21:36 -0700 Subject: [PATCH 6/9] removed extra file to save screen shot quality for review --- .../DefaultWebHostNameDocumentFilter.cs | 29 ------------------- .../COVIDScreeningApi/Startup.cs | 22 ++++++++++++++ 2 files changed, 22 insertions(+), 29 deletions(-) delete mode 100644 Start/COVIDScreeningApi/COVIDScreeningApi/DefaultWebHostNameDocumentFilter.cs diff --git a/Start/COVIDScreeningApi/COVIDScreeningApi/DefaultWebHostNameDocumentFilter.cs b/Start/COVIDScreeningApi/COVIDScreeningApi/DefaultWebHostNameDocumentFilter.cs deleted file mode 100644 index 6423c53..0000000 --- a/Start/COVIDScreeningApi/COVIDScreeningApi/DefaultWebHostNameDocumentFilter.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.Extensions.Configuration; -using Microsoft.OpenApi.Models; -using Swashbuckle.AspNetCore.SwaggerGen; -using System.Collections.Generic; - -namespace COVIDScreeningApi -{ - internal class DefaultWebHostNameDocumentFilter : IDocumentFilter - { - public DefaultWebHostNameDocumentFilter(IConfiguration configuration) - { - Configuration = configuration; - } - - public IConfiguration Configuration { get; } - - public void Apply(OpenApiDocument swaggerDoc, - DocumentFilterContext context) - { - swaggerDoc.Servers = new List() - { - new OpenApiServer() - { - Url = Configuration["SwaggerBaseUrl"] - } - }; - } - } -} \ No newline at end of file diff --git a/Start/COVIDScreeningApi/COVIDScreeningApi/Startup.cs b/Start/COVIDScreeningApi/COVIDScreeningApi/Startup.cs index 69f0fde..ad51172 100644 --- a/Start/COVIDScreeningApi/COVIDScreeningApi/Startup.cs +++ b/Start/COVIDScreeningApi/COVIDScreeningApi/Startup.cs @@ -11,6 +11,7 @@ using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using Microsoft.OpenApi.Models; +using Swashbuckle.AspNetCore.SwaggerGen; namespace COVIDScreeningApi { @@ -60,4 +61,25 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) }); } } + + internal class DefaultWebHostNameDocumentFilter : IDocumentFilter + { + public DefaultWebHostNameDocumentFilter(IConfiguration configuration) + { + Configuration = configuration; + } + + public IConfiguration Configuration { get; } + + public void Apply(OpenApiDocument swaggerDoc, DocumentFilterContext context) + { + swaggerDoc.Servers = new List() + { + new OpenApiServer() + { + Url = Configuration["SwaggerBaseUrl"] + } + }; + } + } } From ab0f15400417ba8ace37d25499c2f98bcda8a087 Mon Sep 17 00:00:00 2001 From: Brady Gaster Date: Sat, 18 Apr 2020 11:31:34 -0700 Subject: [PATCH 7/9] added .vscode folder --- .vscode/launch.json | 36 ++++++++++++++++++++++++++++++++++++ .vscode/tasks.json | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 .vscode/launch.json create mode 100644 .vscode/tasks.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..cdfebfc --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,36 @@ +{ + // Use IntelliSense to find out which attributes exist for C# debugging + // Use hover for the description of the existing attributes + // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md + "version": "0.2.0", + "configurations": [ + { + "name": ".NET Core Launch (web)", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build", + // If you have changed target frameworks, make sure to update the program path. + "program": "${workspaceFolder}/Start/COVIDScreeningApi/COVIDScreeningApi/bin/Debug/netcoreapp3.1/COVIDScreeningApi.dll", + "args": [], + "cwd": "${workspaceFolder}/Start/COVIDScreeningApi/COVIDScreeningApi", + "stopAtEntry": false, + // Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser + "serverReadyAction": { + "action": "openExternally", + "pattern": "^\\s*Now listening on:\\s+(https?://\\S+)" + }, + "env": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "sourceFileMap": { + "/Views": "${workspaceFolder}/Views" + } + }, + { + "name": ".NET Core Attach", + "type": "coreclr", + "request": "attach", + "processId": "${command:pickProcess}" + } + ] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..f150e2d --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,42 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/Start/COVIDScreeningApi/COVIDScreeningApi/COVIDScreeningApi.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "publish", + "command": "dotnet", + "type": "process", + "args": [ + "publish", + "${workspaceFolder}/Start/COVIDScreeningApi/COVIDScreeningApi/COVIDScreeningApi.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "watch", + "command": "dotnet", + "type": "process", + "args": [ + "watch", + "run", + "${workspaceFolder}/Start/COVIDScreeningApi/COVIDScreeningApi/COVIDScreeningApi.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + } + ] +} \ No newline at end of file From 9016024a97dc4d23b44c2472613159120217fde9 Mon Sep 17 00:00:00 2001 From: Brady Gaster Date: Sat, 18 Apr 2020 15:02:31 -0700 Subject: [PATCH 8/9] added swagger-at-build-time Now the Swagger file is produced at build time. I added a `Directory.Build.props` file as we discussed and it worked great. In the props file, there are targets to support everything we need to do to build the Swagger file during publish. This will be useful in describing to engineering an example of how we can achieve this. --- .../COVIDScreeningApi.csproj | 4 +- .../COVIDScreeningApi/Directory.Build.props | 87 +++++++++++++++++++ .../COVIDScreeningApi/Startup.cs | 11 +-- 3 files changed, 95 insertions(+), 7 deletions(-) create mode 100644 Start/COVIDScreeningApi/COVIDScreeningApi/Directory.Build.props diff --git a/Start/COVIDScreeningApi/COVIDScreeningApi/COVIDScreeningApi.csproj b/Start/COVIDScreeningApi/COVIDScreeningApi/COVIDScreeningApi.csproj index 3fb72af..909dd3f 100644 --- a/Start/COVIDScreeningApi/COVIDScreeningApi/COVIDScreeningApi.csproj +++ b/Start/COVIDScreeningApi/COVIDScreeningApi/COVIDScreeningApi.csproj @@ -4,6 +4,7 @@ netcoreapp3.1 5abc7992-35e1-4186-8994-bb96c4a7d0a4 Linux + ScreeningApiV1 @@ -11,8 +12,7 @@ - + - diff --git a/Start/COVIDScreeningApi/COVIDScreeningApi/Directory.Build.props b/Start/COVIDScreeningApi/COVIDScreeningApi/Directory.Build.props new file mode 100644 index 0000000..422560f --- /dev/null +++ b/Start/COVIDScreeningApi/COVIDScreeningApi/Directory.Build.props @@ -0,0 +1,87 @@ + + + + + false + + v1 + v1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Start/COVIDScreeningApi/COVIDScreeningApi/Startup.cs b/Start/COVIDScreeningApi/COVIDScreeningApi/Startup.cs index ad51172..c3d91b0 100644 --- a/Start/COVIDScreeningApi/COVIDScreeningApi/Startup.cs +++ b/Start/COVIDScreeningApi/COVIDScreeningApi/Startup.cs @@ -31,11 +31,12 @@ public void ConfigureServices(IServiceCollection services) services.AddSwaggerGen(config => { config.DocumentFilter(Configuration); - config.SwaggerDoc("v1", new OpenApiInfo - { - Title = "COVIDScreeningApi", - Version = "v1" - }); + config.SwaggerDoc("ScreeningApiV1", + new OpenApiInfo + { + Title = "COVIDScreeningApi", + Version = "v1" + }); }); } From b9d6cfe6946f048d97a4139ae2b84c93efe18713 Mon Sep 17 00:00:00 2001 From: Brady Gaster Date: Sat, 18 Apr 2020 15:09:02 -0700 Subject: [PATCH 9/9] fixed the workflow --- .../COVIDScreeningApi/Directory.Build.props | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Start/COVIDScreeningApi/COVIDScreeningApi/Directory.Build.props b/Start/COVIDScreeningApi/COVIDScreeningApi/Directory.Build.props index 422560f..ff8c36b 100644 --- a/Start/COVIDScreeningApi/COVIDScreeningApi/Directory.Build.props +++ b/Start/COVIDScreeningApi/COVIDScreeningApi/Directory.Build.props @@ -64,17 +64,6 @@ - - - - - - - - - - + + + + + + + \ No newline at end of file