Fixed apiexplorer
This commit is contained in:
@@ -17,7 +17,12 @@ Need to consider re-thinking versioning system of api to remove the complexity o
|
|||||||
Test out versioning in the test project I made following the Swashbuckle guide for multiple docs:
|
Test out versioning in the test project I made following the Swashbuckle guide for multiple docs:
|
||||||
https://github.com/domaindrivendev/Swashbuckle.AspNetCore#list-multiple-swagger-documents
|
https://github.com/domaindrivendev/Swashbuckle.AspNetCore#list-multiple-swagger-documents
|
||||||
|
|
||||||
Because maybe this is the way to go?
|
|
||||||
|
- Update my code to the modern standard: https://kimsereyblog.blogspot.com/2018/08/apicontroller-attribute-in-asp-net-core.html
|
||||||
|
- Note that that above is for v2.2 my controllers appear to date from the v1 .net core era and I will need to then move them to the .netcore 3.1 era changes
|
||||||
|
- This is important and worth doing to make sure everything will work going forward (the swashbuckle [apicontroller] attribute debacle is proof of this)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Need a sprint to get to a fully testable client with entry form, list and as much as possible all features from COMMON-* specs list
|
Need a sprint to get to a fully testable client with entry form, list and as much as possible all features from COMMON-* specs list
|
||||||
|
|||||||
@@ -28,9 +28,9 @@ The "response body" section will contain the return value, something similar to
|
|||||||
|
|
||||||
The highlighted line above contains the token you require, copy the token value not including the quotation marks. This is your access token.
|
The highlighted line above contains the token you require, copy the token value not including the quotation marks. This is your access token.
|
||||||
|
|
||||||
Click on the "Authorize" button at the top of the API console and a popup dialog box will open. In the "Value" box the dialog enter the word Bearer followed by a space and then your api token, for example using the above you would paste in:
|
Click on the "Authorize" button at the top of the API console and a popup dialog box will open. In the "Value" box the dialog enter your api token, for example using the above you would paste in:
|
||||||
|
|
||||||
`Bearer xyGhbGciOiJIUzI1NiIsInR4cCI6IkpXVCJ9.utJpYXQ4OiIxNqE4MDM0MzcfIiwiZXhwjjoiMTUyMDYyNjM8MCIsImlocyI0IkF53U5vdmEiLCJpZCI6IjEifQ.z7QaHKt2VbcysunIvsfa-51X7owB1EYcyhpkdkfaqzy`
|
`xyGhbGciOiJIUzI1NiIsInR4cCI6IkpXVCJ9.utJpYXQ4OiIxNqE4MDM0MzcfIiwiZXhwjjoiMTUyMDYyNjM8MCIsImlocyI0IkF53U5vdmEiLCJpZCI6IjEifQ.z7QaHKt2VbcysunIvsfa-51X7owB1EYcyhpkdkfaqzy`
|
||||||
|
|
||||||
then click on the "Authorize" button inside the popup dialog box.
|
then click on the "Authorize" button inside the popup dialog box.
|
||||||
|
|
||||||
|
|||||||
@@ -32,11 +32,12 @@ namespace AyaNova.Api.Controllers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Attachment controller
|
/// Attachment controller
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
[ApiVersion("8.0")]
|
[ApiVersion("8.0")]
|
||||||
[Route("api/v{version:apiVersion}/[controller]")]
|
[Route("api/v{version:apiVersion}/[controller]")]
|
||||||
[Produces("application/json")]
|
[Produces("application/json")]
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public class AttachmentController : Controller
|
public class AttachmentController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly AyContext ct;
|
private readonly AyContext ct;
|
||||||
private readonly ILogger<AttachmentController> log;
|
private readonly ILogger<AttachmentController> log;
|
||||||
|
|||||||
@@ -19,10 +19,11 @@ namespace AyaNova.Api.Controllers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Authentication controller
|
/// Authentication controller
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
[ApiVersion("8.0")]
|
[ApiVersion("8.0")]
|
||||||
[Route("api/v{version:apiVersion}/[controller]")]
|
[Route("api/v{version:apiVersion}/[controller]")]
|
||||||
[Produces("application/json")]
|
[Produces("application/json")]
|
||||||
public class AuthController : Controller
|
public class AuthController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly AyContext ct;
|
private readonly AyContext ct;
|
||||||
private readonly ILogger<AuthController> log;
|
private readonly ILogger<AuthController> log;
|
||||||
|
|||||||
@@ -15,11 +15,12 @@ namespace AyaNova.Api.Controllers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Enum pick list controller
|
/// Enum pick list controller
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
[ApiVersion("8.0")]
|
[ApiVersion("8.0")]
|
||||||
[Route("api/v{version:apiVersion}/[controller]")]
|
[Route("api/v{version:apiVersion}/[controller]")]
|
||||||
[Produces("application/json")]
|
[Produces("application/json")]
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public class AyaEnumPickListController : Controller
|
public class AyaEnumPickListController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly AyContext ct;
|
private readonly AyContext ct;
|
||||||
private readonly ILogger<AyaTypeController> log;
|
private readonly ILogger<AyaTypeController> log;
|
||||||
|
|||||||
@@ -15,11 +15,12 @@ namespace AyaNova.Api.Controllers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// AyaType list controller
|
/// AyaType list controller
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
[ApiVersion("8.0")]
|
[ApiVersion("8.0")]
|
||||||
[Route("api/v{version:apiVersion}/[controller]")]
|
[Route("api/v{version:apiVersion}/[controller]")]
|
||||||
[Produces("application/json")]
|
[Produces("application/json")]
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public class AyaTypeController : Controller
|
public class AyaTypeController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly AyContext ct;
|
private readonly AyContext ct;
|
||||||
private readonly ILogger<AyaTypeController> log;
|
private readonly ILogger<AyaTypeController> log;
|
||||||
|
|||||||
@@ -1,24 +1,9 @@
|
|||||||
using System;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Microsoft.AspNetCore.Http;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Routing;
|
using Microsoft.AspNetCore.Routing;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
using AyaNova.Api.ControllerHelpers;
|
using AyaNova.Api.ControllerHelpers;
|
||||||
using AyaNova.Util;
|
|
||||||
|
|
||||||
using System.Globalization;
|
|
||||||
using System.IO;
|
|
||||||
using System.Text;
|
|
||||||
using Microsoft.AspNetCore.Http.Features;
|
|
||||||
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
|
||||||
using Microsoft.AspNetCore.WebUtilities;
|
|
||||||
using Microsoft.Net.Http.Headers;
|
|
||||||
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -46,11 +31,12 @@ namespace AyaNova.Api.Controllers
|
|||||||
/// and triggering a restore from backup
|
/// and triggering a restore from backup
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
[ApiVersion("8.0")]
|
[ApiVersion("8.0")]
|
||||||
[Route("api/v{version:apiVersion}/[controller]")]
|
[Route("api/v{version:apiVersion}/[controller]")]
|
||||||
[Produces("application/json")]
|
[Produces("application/json")]
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public class BackupController : Controller
|
public class BackupController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly AyContext ct;
|
private readonly AyContext ct;
|
||||||
private readonly ILogger<BackupController> log;
|
private readonly ILogger<BackupController> log;
|
||||||
|
|||||||
@@ -19,11 +19,12 @@ namespace AyaNova.Api.Controllers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
[ApiVersion("8.0")]
|
[ApiVersion("8.0")]
|
||||||
[Route("api/v{version:apiVersion}/[controller]")]
|
[Route("api/v{version:apiVersion}/[controller]")]
|
||||||
[Produces("application/json")]
|
[Produces("application/json")]
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public class DataFilterController : Controller
|
public class DataFilterController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly AyContext ct;
|
private readonly AyContext ct;
|
||||||
private readonly ILogger<DataFilterController> log;
|
private readonly ILogger<DataFilterController> log;
|
||||||
|
|||||||
@@ -19,10 +19,11 @@ namespace AyaNova.Api.Controllers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Log files controller
|
/// Log files controller
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
[ApiVersion("8.0")]
|
[ApiVersion("8.0")]
|
||||||
[Route("api/v{version:apiVersion}/[controller]")]
|
[Route("api/v{version:apiVersion}/[controller]")]
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public class EventLogController : Controller
|
public class EventLogController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly AyContext ct;
|
private readonly AyContext ct;
|
||||||
private readonly ILogger<LogFilesController> log;
|
private readonly ILogger<LogFilesController> log;
|
||||||
|
|||||||
@@ -19,11 +19,12 @@ namespace AyaNova.Api.Controllers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
[ApiVersion("8.0")]
|
[ApiVersion("8.0")]
|
||||||
[Route("api/v{version:apiVersion}/[controller]")]
|
[Route("api/v{version:apiVersion}/[controller]")]
|
||||||
[Produces("application/json")]
|
[Produces("application/json")]
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public class FormCustomController : Controller
|
public class FormCustomController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly AyContext ct;
|
private readonly AyContext ct;
|
||||||
private readonly ILogger<FormCustomController> log;
|
private readonly ILogger<FormCustomController> log;
|
||||||
|
|||||||
@@ -29,11 +29,12 @@ namespace AyaNova.Api.Controllers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Import AyaNova 7 data controller
|
/// Import AyaNova 7 data controller
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
[ApiVersion("8.0")]
|
[ApiVersion("8.0")]
|
||||||
[Route("api/v{version:apiVersion}/[controller]")]
|
[Route("api/v{version:apiVersion}/[controller]")]
|
||||||
[Produces("application/json")]
|
[Produces("application/json")]
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public class ImportAyaNova7Controller : Controller
|
public class ImportAyaNova7Controller : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly AyContext ct;
|
private readonly AyContext ct;
|
||||||
private readonly ILogger<ImportAyaNova7Controller> log;
|
private readonly ILogger<ImportAyaNova7Controller> log;
|
||||||
|
|||||||
@@ -17,11 +17,12 @@ namespace AyaNova.Api.Controllers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// JobOperations controller
|
/// JobOperations controller
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
[ApiVersion("8.0")]
|
[ApiVersion("8.0")]
|
||||||
[Route("api/v{version:apiVersion}/[controller]")]
|
[Route("api/v{version:apiVersion}/[controller]")]
|
||||||
[Produces("application/json")]
|
[Produces("application/json")]
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public class JobOperationsController : Controller
|
public class JobOperationsController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly AyContext ct;
|
private readonly AyContext ct;
|
||||||
private readonly ILogger<JobOperationsController> log;
|
private readonly ILogger<JobOperationsController> log;
|
||||||
|
|||||||
@@ -16,11 +16,12 @@ namespace AyaNova.Api.Controllers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// License route
|
/// License route
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
[ApiVersion("8.0")]
|
[ApiVersion("8.0")]
|
||||||
[Route("api/v{version:apiVersion}/[controller]")]
|
[Route("api/v{version:apiVersion}/[controller]")]
|
||||||
[Produces("application/json")]
|
[Produces("application/json")]
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public class LicenseController : Controller
|
public class LicenseController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly AyContext ct;
|
private readonly AyContext ct;
|
||||||
private readonly ILogger<LicenseController> log;
|
private readonly ILogger<LicenseController> log;
|
||||||
|
|||||||
@@ -23,11 +23,12 @@ namespace AyaNova.Api.Controllers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Localized text controller
|
/// Localized text controller
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
[ApiVersion("8.0")]
|
[ApiVersion("8.0")]
|
||||||
[Route("api/v{version:apiVersion}/[controller]")]
|
[Route("api/v{version:apiVersion}/[controller]")]
|
||||||
[Produces("application/json")]
|
[Produces("application/json")]
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public class LocaleController : Controller
|
public class LocaleController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly AyContext ct;
|
private readonly AyContext ct;
|
||||||
private readonly ILogger<LocaleController> log;
|
private readonly ILogger<LocaleController> log;
|
||||||
|
|||||||
@@ -16,11 +16,12 @@ namespace AyaNova.Api.Controllers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Log files controller
|
/// Log files controller
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
[ApiVersion("8.0")]
|
[ApiVersion("8.0")]
|
||||||
[Route("api/v{version:apiVersion}/[controller]")]
|
[Route("api/v{version:apiVersion}/[controller]")]
|
||||||
//[Produces("application/json")]
|
//[Produces("application/json")]
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public class LogFilesController : Controller
|
public class LogFilesController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly AyContext ct;
|
private readonly AyContext ct;
|
||||||
private readonly ILogger<LogFilesController> log;
|
private readonly ILogger<LogFilesController> log;
|
||||||
|
|||||||
@@ -18,10 +18,11 @@ namespace AyaNova.Api.Controllers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Log files controller
|
/// Log files controller
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
[ApiVersion("8.0")]
|
[ApiVersion("8.0")]
|
||||||
[Route("api/v{version:apiVersion}/[controller]")]
|
[Route("api/v{version:apiVersion}/[controller]")]
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public class MetricsController : Controller
|
public class MetricsController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly AyContext ct;
|
private readonly AyContext ct;
|
||||||
private readonly ILogger<LogFilesController> log;
|
private readonly ILogger<LogFilesController> log;
|
||||||
|
|||||||
@@ -19,11 +19,12 @@ namespace AyaNova.Api.Controllers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Search
|
/// Search
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
[ApiVersion("8.0")]
|
[ApiVersion("8.0")]
|
||||||
[Route("api/v{version:apiVersion}/[controller]")]
|
[Route("api/v{version:apiVersion}/[controller]")]
|
||||||
[Produces("application/json")]
|
[Produces("application/json")]
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public class SearchController : Controller
|
public class SearchController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly AyContext ct;
|
private readonly AyContext ct;
|
||||||
private readonly ILogger<WidgetController> log;
|
private readonly ILogger<WidgetController> log;
|
||||||
|
|||||||
@@ -15,10 +15,11 @@ namespace AyaNova.Api.Controllers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Server state controller
|
/// Server state controller
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
[ApiVersion("8.0")]
|
[ApiVersion("8.0")]
|
||||||
[Route("api/v{version:apiVersion}/[controller]")]
|
[Route("api/v{version:apiVersion}/[controller]")]
|
||||||
[Produces("application/json")]
|
[Produces("application/json")]
|
||||||
public class ServerStateController : Controller
|
public class ServerStateController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly AyContext ct;
|
private readonly AyContext ct;
|
||||||
private readonly ILogger<ServerStateController> log;
|
private readonly ILogger<ServerStateController> log;
|
||||||
|
|||||||
@@ -15,11 +15,12 @@ namespace AyaNova.Api.Controllers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Enum pick list controller
|
/// Enum pick list controller
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
[ApiVersion("8.0")]
|
[ApiVersion("8.0")]
|
||||||
[Route("api/v{version:apiVersion}/[controller]")]
|
[Route("api/v{version:apiVersion}/[controller]")]
|
||||||
[Produces("application/json")]
|
[Produces("application/json")]
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public class TagListController : Controller
|
public class TagListController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly AyContext ct;
|
private readonly AyContext ct;
|
||||||
private readonly ILogger<AyaTypeController> log;
|
private readonly ILogger<AyaTypeController> log;
|
||||||
|
|||||||
@@ -13,11 +13,12 @@ namespace AyaNova.Api.Controllers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///Test controller class used during development
|
///Test controller class used during development
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
[ApiVersion("8.0")]
|
[ApiVersion("8.0")]
|
||||||
[Route("api/v{version:apiVersion}/[controller]")]
|
[Route("api/v{version:apiVersion}/[controller]")]
|
||||||
[Produces("application/json")]
|
[Produces("application/json")]
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public class TrialController : Controller
|
public class TrialController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly AyContext ct;
|
private readonly AyContext ct;
|
||||||
private readonly ILogger<WidgetController> log;
|
private readonly ILogger<WidgetController> log;
|
||||||
|
|||||||
@@ -19,11 +19,12 @@ namespace AyaNova.Api.Controllers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// User
|
/// User
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
[ApiVersion("8.0")]
|
[ApiVersion("8.0")]
|
||||||
[Route("api/v{version:apiVersion}/[controller]")]
|
[Route("api/v{version:apiVersion}/[controller]")]
|
||||||
[Produces("application/json")]
|
[Produces("application/json")]
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public class UserController : Controller
|
public class UserController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly AyContext ct;
|
private readonly AyContext ct;
|
||||||
private readonly ILogger<UserController> log;
|
private readonly ILogger<UserController> log;
|
||||||
|
|||||||
@@ -19,11 +19,12 @@ namespace AyaNova.Api.Controllers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// UserOptions
|
/// UserOptions
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
[ApiVersion("8.0")]
|
[ApiVersion("8.0")]
|
||||||
[Route("api/v{version:apiVersion}/[controller]")]
|
[Route("api/v{version:apiVersion}/[controller]")]
|
||||||
[Produces("application/json")]
|
[Produces("application/json")]
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public class UserOptionsController : Controller
|
public class UserOptionsController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly AyContext ct;
|
private readonly AyContext ct;
|
||||||
private readonly ILogger<UserOptionsController> log;
|
private readonly ILogger<UserOptionsController> log;
|
||||||
|
|||||||
@@ -22,11 +22,12 @@ namespace AyaNova.Api.Controllers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sample controller class used during development for testing purposes
|
/// Sample controller class used during development for testing purposes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
[ApiVersion("8.0")]
|
[ApiVersion("8.0")]
|
||||||
[Route("api/v{version:apiVersion}/[controller]")]
|
[Route("api/v{version:apiVersion}/[controller]")]
|
||||||
[Produces("application/json")]
|
[Produces("application/json")]
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public class WidgetController : Controller
|
public class WidgetController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly AyContext ct;
|
private readonly AyContext ct;
|
||||||
private readonly ILogger<WidgetController> log;
|
private readonly ILogger<WidgetController> log;
|
||||||
|
|||||||
@@ -149,23 +149,30 @@ namespace AyaNova
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Add service and create Policy with options
|
||||||
|
_log.LogDebug("BOOT: init CORS service");
|
||||||
|
services.AddCors(options =>
|
||||||
|
{
|
||||||
|
options.AddPolicy("CorsPolicy",
|
||||||
|
builder => builder.AllowAnyOrigin()
|
||||||
|
.AllowAnyMethod()
|
||||||
|
.AllowAnyHeader()
|
||||||
|
//.AllowCredentials()
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region Swagger
|
#region Swagger
|
||||||
|
|
||||||
// services
|
services
|
||||||
// .AddApiVersioning(options =>
|
.AddApiVersioning(options =>
|
||||||
// {
|
{
|
||||||
// options.AssumeDefaultVersionWhenUnspecified = true;
|
options.AssumeDefaultVersionWhenUnspecified = true;
|
||||||
// options.DefaultApiVersion = Microsoft.AspNetCore.Mvc.ApiVersion.Parse("8.0");
|
options.DefaultApiVersion = Microsoft.AspNetCore.Mvc.ApiVersion.Parse("8.0");
|
||||||
// options.ReportApiVersions = true;
|
options.ReportApiVersions = true;
|
||||||
// });
|
});
|
||||||
|
|
||||||
// services.AddVersionedApiExplorer(o => o.GroupNameFormat = "'v'VVV");
|
|
||||||
|
|
||||||
services.AddApiVersioning();
|
|
||||||
services.AddVersionedApiExplorer(options => options.GroupNameFormat = "'v'VVV");
|
services.AddVersionedApiExplorer(options => options.GroupNameFormat = "'v'VVV");
|
||||||
|
|
||||||
// services.AddSwaggerGen(
|
// services.AddSwaggerGen(
|
||||||
@@ -184,8 +191,32 @@ namespace AyaNova
|
|||||||
// return versions.Any(v => $"v{v.ToString()}" == docName);
|
// return versions.Any(v => $"v{v.ToString()}" == docName);
|
||||||
// });
|
// });
|
||||||
// });
|
// });
|
||||||
services.AddTransient<IConfigureOptions<SwaggerGenOptions>, ConfigureSwaggerOptions>();
|
services.AddTransient<IConfigureOptions<SwaggerGenOptions>, ConfigureSwaggerOptions>();
|
||||||
services.AddSwaggerGen();
|
services.AddSwaggerGen(
|
||||||
|
c=>{
|
||||||
|
|
||||||
|
//https://stackoverflow.com/questions/56234504/migrating-to-swashbuckle-aspnetcore-version-5
|
||||||
|
//First we define the security scheme
|
||||||
|
c.AddSecurityDefinition("Bearer", //Name the security scheme
|
||||||
|
new OpenApiSecurityScheme
|
||||||
|
{
|
||||||
|
Description = "JWT Authorization header using the Bearer scheme.",
|
||||||
|
Type = SecuritySchemeType.Http, //We set the scheme type to http since we're using bearer authentication
|
||||||
|
Scheme = "bearer" //The name of the HTTP Authorization scheme to be used in the Authorization header. In this case "bearer".
|
||||||
|
});
|
||||||
|
|
||||||
|
c.AddSecurityRequirement(new OpenApiSecurityRequirement{
|
||||||
|
{
|
||||||
|
new OpenApiSecurityScheme{
|
||||||
|
Reference = new OpenApiReference{
|
||||||
|
Id = "Bearer", //The name of the previously defined security scheme.
|
||||||
|
Type = ReferenceType.SecurityScheme
|
||||||
|
}
|
||||||
|
},new List<string>()
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -350,29 +381,7 @@ namespace AyaNova
|
|||||||
|
|
||||||
_log.LogDebug("BOOT: pipeline - api explorer");
|
_log.LogDebug("BOOT: pipeline - api explorer");
|
||||||
// Enable middleware to serve generated Swagger as a JSON endpoint.
|
// Enable middleware to serve generated Swagger as a JSON endpoint.
|
||||||
// app.UseSwagger();
|
app.UseSwagger();
|
||||||
|
|
||||||
// app.UseSwaggerUI(c =>
|
|
||||||
// {
|
|
||||||
// // build a swagger endpoint for each discovered API version
|
|
||||||
// foreach (var description in provider.ApiVersionDescriptions)
|
|
||||||
// {
|
|
||||||
// c.SwaggerEndpoint($"/swagger/{description.GroupName}/swagger.json", description.GroupName.ToUpperInvariant());
|
|
||||||
// }
|
|
||||||
|
|
||||||
// //clean up the swagger explorer UI page and remove the branding
|
|
||||||
// //via our own css
|
|
||||||
// //NOTE: this broke when updated to v2.x of swagger and it can be fixed according to docs:
|
|
||||||
// //https://github.com/domaindrivendev/Swashbuckle.AspNetCore#inject-custom-css
|
|
||||||
// // c.InjectStylesheet("/api/sw.css");
|
|
||||||
|
|
||||||
// c.DefaultModelsExpandDepth(-1);
|
|
||||||
// c.DocumentTitle = "AyaNova API explorer";
|
|
||||||
// c.RoutePrefix = "api-docs";
|
|
||||||
// });
|
|
||||||
|
|
||||||
app.UseSwagger();
|
|
||||||
|
|
||||||
app.UseSwaggerUI(
|
app.UseSwaggerUI(
|
||||||
options =>
|
options =>
|
||||||
{
|
{
|
||||||
@@ -382,8 +391,9 @@ namespace AyaNova
|
|||||||
$"/swagger/{description.GroupName}/swagger.json",
|
$"/swagger/{description.GroupName}/swagger.json",
|
||||||
description.GroupName.ToUpperInvariant());
|
description.GroupName.ToUpperInvariant());
|
||||||
}
|
}
|
||||||
|
options.DefaultModelsExpandDepth(-1);//This is meant to hide the Models section that would appear at the bottom of the swagger ui showing *all* models from the api
|
||||||
options.DocumentTitle = "AyaNova API explorer";
|
options.DocumentTitle = "AyaNova API explorer";
|
||||||
options.RoutePrefix = "api-docs";
|
options.RoutePrefix = "api-docs";
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user