Swagger: Adding every module, not just the core

This commit is contained in:
Zoe Roux
2021-09-16 21:37:37 +02:00
parent ba37a7cb9b
commit 340950177e
4 changed files with 10 additions and 1 deletions
@@ -177,6 +177,7 @@ namespace Kyoo.Authentication.Views
}
/// <inheritdoc />
[ApiExplorerSettings(IgnoreApi = true)]
public async Task GetProfileDataAsync(ProfileDataRequestContext context)
{
User user = await _users.GetOrDefault(int.Parse(context.Subject.GetSubjectId()));
@@ -187,6 +188,7 @@ namespace Kyoo.Authentication.Views
}
/// <inheritdoc />
[ApiExplorerSettings(IgnoreApi = true)]
public async Task IsActiveAsync(IsActiveContext context)
{
User user = await _users.GetOrDefault(int.Parse(context.Subject.GetSubjectId()));
+3 -1
View File
@@ -138,7 +138,9 @@ namespace Kyoo.Core
{
string publicUrl = _configuration.GetPublicUrl();
services.AddMvc().AddControllersAsServices();
services.AddMvcCore()
.AddControllersAsServices()
.AddApiExplorer();
services.AddControllers()
.AddNewtonsoftJson(x =>
{
+4
View File
@@ -19,6 +19,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Autofac;
using Kyoo.Abstractions;
using Kyoo.Abstractions.Controllers;
@@ -108,6 +109,9 @@ namespace Kyoo.Core
/// <param name="services">The service collection to fill.</param>
public void ConfigureServices(IServiceCollection services)
{
foreach (Assembly assembly in _plugins.GetAllPlugins().Select(x => x.GetType().Assembly))
services.AddMvcCore().AddApplicationPart(assembly);
foreach (IPlugin plugin in _plugins.GetAllPlugins())
plugin.Configure(services);
+1
View File
@@ -21,6 +21,7 @@ using System.Collections.Generic;
using System.IO;
using Kyoo.Abstractions.Controllers;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Mvc.ApiExplorer;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.OpenApi.Models;