Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions OpenAPI/LearningHub.Nhs.OpenApi/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,16 @@ public void ConfigureServices(IServiceCollection services)
services.AddMvc()
.AddNewtonsoftJson(options => options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore);

var swaggerTitle = this.Configuration["Swagger:Title"];
var swaggerVersion = this.Configuration["Swagger:Version"];
var swaggerDescription = $"A set of API endpoints for retrieving learning resource information from the Learning Hub learning platform. The [Learning Hub](https://learninghub.nhs.uk/) is a platform for hosting and sharing learning resources for health and social care provided by Technology Enhanced Learning (TEL) at NHS England. An application API key must be used to authorise calls to the API from external applications. To contact TEL to discuss connecting your external system to the Learning Hub, email england.tel@nhs.net.\n\n Build Number: {this.Configuration["Swagger:BuildNumber"]} \n\n";

services.AddSwaggerGen(
c =>
{
// For docs see https://github.com/domaindrivendev/Swashbuckle.AspNetCore
c.SwaggerDoc("dev", new OpenApiInfo { Title = "LearningHub.NHS.OpenAPI", Version = "dev" });
c.SwaggerDoc("dev", new OpenApiInfo { Title = swaggerTitle, Version = swaggerVersion, Description = swaggerDescription });

c.CustomSchemaIds(type => type.FullName);
c.AddSecurityDefinition(
"ApiKey",
Expand Down Expand Up @@ -220,12 +225,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
app.UseSwagger();
app.UseSwaggerUI(c =>
{
if (env.IsDevelopment())
{
c.SwaggerEndpoint("/swagger/dev/swagger.json", "Auto-generated");
}

c.SwaggerEndpoint("/SwaggerDefinitions/v1.3.0.json", "v1.3.0");
c.SwaggerEndpoint("/swagger/dev/swagger.json", "v1.4.0");
c.OAuthClientId(this.Configuration.GetValue<string>("LearningHubAuthServiceConfig:ClientId"));
c.OAuthClientSecret(this.Configuration.GetValue<string>("LearningHubAuthServiceConfig:ClientSecret"));
c.OAuthScopes(this.Configuration.GetValue<string>("LearningHubAuthServiceConfig:Scopes"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"info": {
"title": "LearningHub.NHS.OpenAPI",
"version": "1.3.0",
"description": "A set of API endpoints for retrieving learning resource information from the Learning Hub learning platform. The [Learning Hub](https://learninghub.nhs.uk/) is a platform for hosting and sharing learning resources for health and social care provided by Technology Enhanced Learning (TEL) at NHS England. An application API key must be used to authorise calls to the API from external applications. To contact TEL to discuss connecting your external system to the Learning Hub, email england.tel@nhs.net. \n\n**Build Number:** __BUILD_NUMBER__\n\n"
"description": "A set of API endpoints for retrieving learning resource information from the Learning Hub learning platform. The [Learning Hub](https://learninghub.nhs.uk/) is a platform for hosting and sharing learning resources for health and social care provided by Technology Enhanced Learning (TEL) at NHS England. An application API key must be used to authorise calls to the API from external applications. To contact TEL to discuss connecting your external system to the Learning Hub, email england.tel@nhs.net."
},
"paths": {
"/Bookmark/GetAllByParent": {
Expand Down
5 changes: 5 additions & 0 deletions OpenAPI/LearningHub.Nhs.OpenApi/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
"Microsoft.Hosting.Lifetime": "Information"
}
},
"Swagger": {
"Title": "Swagger XML DOC LearningHub.NHS.OpenAPI",
"Version": "v4.1.0",
"BuildNumber": ""
},
"AllowedHosts": "*",
"ConnectionStrings": {
"ElfhHubDbConnection": "<configure-in-env-var>",
Expand Down
Loading