mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-16 02:02:55 -07:00
fix: Improve Swagger documentation (#4652)
* Upgrade Swashbuckle dependency * Document /token response * Add support for Newtonsoft annotations in Swagger * Remove unecessary ActionResult [skip ci]
This commit is contained in:
parent
ae430e700c
commit
181892bcfe
4 changed files with 23 additions and 4 deletions
|
@ -1,4 +1,5 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace Ombi.Api.Plex.Models
|
namespace Ombi.Api.Plex.Models
|
||||||
{
|
{
|
||||||
|
@ -38,6 +39,9 @@ namespace Ombi.Api.Plex.Models
|
||||||
public string grandparentTheme { get; set; }
|
public string grandparentTheme { get; set; }
|
||||||
public string chapterSource { get; set; }
|
public string chapterSource { get; set; }
|
||||||
public Medium[] Media { get; set; }
|
public Medium[] Media { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
[JsonProperty("guids")]
|
||||||
public List<PlexGuids> Guid { get; set; } = new List<PlexGuids>();
|
public List<PlexGuids> Guid { get; set; } = new List<PlexGuids>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,9 +16,20 @@ using Ombi.Store.Entities;
|
||||||
using Ombi.Store.Repository;
|
using Ombi.Store.Repository;
|
||||||
using Ombi.Core.Settings;
|
using Ombi.Core.Settings;
|
||||||
using Ombi.Settings.Settings.Models;
|
using Ombi.Settings.Settings.Models;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace Ombi.Controllers.V1
|
namespace Ombi.Controllers.V1
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
public class Token
|
||||||
|
{
|
||||||
|
[JsonProperty("access_token")]
|
||||||
|
public string AccessToken { get; set; }
|
||||||
|
public DateTime Expiration { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
[ApiV1]
|
[ApiV1]
|
||||||
[Produces("application/json")]
|
[Produces("application/json")]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
|
@ -47,6 +58,7 @@ namespace Ombi.Controllers.V1
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[ProducesResponseType(401)]
|
[ProducesResponseType(401)]
|
||||||
|
[ProducesResponseType(typeof(Token), 200)]
|
||||||
public async Task<IActionResult> GetToken([FromBody] UserAuthModel model)
|
public async Task<IActionResult> GetToken([FromBody] UserAuthModel model)
|
||||||
{
|
{
|
||||||
if (!model.UsePlexOAuth)
|
if (!model.UsePlexOAuth)
|
||||||
|
@ -161,10 +173,10 @@ namespace Ombi.Controllers.V1
|
||||||
|
|
||||||
await _userManager.UpdateAsync(user);
|
await _userManager.UpdateAsync(user);
|
||||||
|
|
||||||
return new JsonResult(new
|
return Ok(new Token
|
||||||
{
|
{
|
||||||
access_token = accessToken,
|
AccessToken = accessToken,
|
||||||
expiration = token.ValidTo
|
Expiration = token.ValidTo
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,6 +79,8 @@ namespace Ombi
|
||||||
|
|
||||||
c.DescribeAllParametersInCamelCase();
|
c.DescribeAllParametersInCamelCase();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
services.AddSwaggerGenNewtonsoftSupport();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AddAppSettingsValues(this IServiceCollection services, IConfigurationRoot configuration)
|
public static void AddAppSettingsValues(this IServiceCollection services, IConfigurationRoot configuration)
|
||||||
|
|
|
@ -79,7 +79,8 @@
|
||||||
<PackageReference Include="Serilog.Extensions.Logging" Version="3.0.1" />
|
<PackageReference Include="Serilog.Extensions.Logging" Version="3.0.1" />
|
||||||
<PackageReference Include="Serilog.Sinks.File" Version="4.1.0" />
|
<PackageReference Include="Serilog.Sinks.File" Version="4.1.0" />
|
||||||
<PackageReference Include="Serilog.Settings.Configuration" Version="3.3.0" />
|
<PackageReference Include="Serilog.Settings.Configuration" Version="3.3.0" />
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.0.0" />
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.3.1" />
|
||||||
|
<PackageReference Include="Swashbuckle.AspNetCore.Newtonsoft" Version="6.3.1" />
|
||||||
<PackageReference Include="System.Security.Cryptography.Csp" Version="4.3.0" />
|
<PackageReference Include="System.Security.Cryptography.Csp" Version="4.3.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.SpaServices" Version="5.0.0-preview.8.20414.8" />
|
<PackageReference Include="Microsoft.AspNetCore.SpaServices" Version="5.0.0-preview.8.20414.8" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="6.0.0" />
|
<PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="6.0.0" />
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue