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

View File

@ -177,6 +177,7 @@ namespace Kyoo.Authentication.Views
} }
/// <inheritdoc /> /// <inheritdoc />
[ApiExplorerSettings(IgnoreApi = true)]
public async Task GetProfileDataAsync(ProfileDataRequestContext context) public async Task GetProfileDataAsync(ProfileDataRequestContext context)
{ {
User user = await _users.GetOrDefault(int.Parse(context.Subject.GetSubjectId())); User user = await _users.GetOrDefault(int.Parse(context.Subject.GetSubjectId()));
@ -187,6 +188,7 @@ namespace Kyoo.Authentication.Views
} }
/// <inheritdoc /> /// <inheritdoc />
[ApiExplorerSettings(IgnoreApi = true)]
public async Task IsActiveAsync(IsActiveContext context) public async Task IsActiveAsync(IsActiveContext context)
{ {
User user = await _users.GetOrDefault(int.Parse(context.Subject.GetSubjectId())); User user = await _users.GetOrDefault(int.Parse(context.Subject.GetSubjectId()));

View File

@ -138,7 +138,9 @@ namespace Kyoo.Core
{ {
string publicUrl = _configuration.GetPublicUrl(); string publicUrl = _configuration.GetPublicUrl();
services.AddMvc().AddControllersAsServices(); services.AddMvcCore()
.AddControllersAsServices()
.AddApiExplorer();
services.AddControllers() services.AddControllers()
.AddNewtonsoftJson(x => .AddNewtonsoftJson(x =>
{ {

View File

@ -19,6 +19,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection;
using Autofac; using Autofac;
using Kyoo.Abstractions; using Kyoo.Abstractions;
using Kyoo.Abstractions.Controllers; using Kyoo.Abstractions.Controllers;
@ -108,6 +109,9 @@ namespace Kyoo.Core
/// <param name="services">The service collection to fill.</param> /// <param name="services">The service collection to fill.</param>
public void ConfigureServices(IServiceCollection services) 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()) foreach (IPlugin plugin in _plugins.GetAllPlugins())
plugin.Configure(services); plugin.Configure(services);

View File

@ -21,6 +21,7 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using Kyoo.Abstractions.Controllers; using Kyoo.Abstractions.Controllers;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Mvc.ApiExplorer;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models;