From ef97ead707a100f1599d22a7b37095ed6f3fd041 Mon Sep 17 00:00:00 2001 From: crobibero Date: Sun, 24 Jan 2021 14:36:36 -0700 Subject: [PATCH 1/2] Fix openapi nullable properties --- Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs b/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs index 77fb64674..da4cc267b 100644 --- a/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs +++ b/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs @@ -308,6 +308,9 @@ namespace Jellyfin.Server.Extensions ?? null; }); + // Allow parameters to properly be nullable. + c.UseAllOfToExtendReferenceSchemas(); + // TODO - remove when all types are supported in System.Text.Json c.AddSwaggerTypeMappings(); From 77b417e41e76dadfacbff5605c81eeb5ce2d5d2d Mon Sep 17 00:00:00 2001 From: crobibero Date: Sun, 24 Jan 2021 15:02:56 -0700 Subject: [PATCH 2/2] Mark non-nullable body as null --- Jellyfin.Api/Controllers/PackageController.cs | 2 +- Jellyfin.Api/Controllers/UserController.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Jellyfin.Api/Controllers/PackageController.cs b/Jellyfin.Api/Controllers/PackageController.cs index 9ab8e0bdc..c589f54ac 100644 --- a/Jellyfin.Api/Controllers/PackageController.cs +++ b/Jellyfin.Api/Controllers/PackageController.cs @@ -158,7 +158,7 @@ namespace Jellyfin.Api.Controllers [HttpPost("Repositories")] [Authorize(Policy = Policies.DefaultAuthorization)] [ProducesResponseType(StatusCodes.Status204NoContent)] - public ActionResult SetRepositories([FromBody] List repositoryInfos) + public ActionResult SetRepositories([FromBody, Required] List repositoryInfos) { _serverConfigurationManager.Configuration.PluginRepositories = repositoryInfos; _serverConfigurationManager.SaveConfiguration(); diff --git a/Jellyfin.Api/Controllers/UserController.cs b/Jellyfin.Api/Controllers/UserController.cs index 0f0bee4bc..87a4ffd92 100644 --- a/Jellyfin.Api/Controllers/UserController.cs +++ b/Jellyfin.Api/Controllers/UserController.cs @@ -514,7 +514,7 @@ namespace Jellyfin.Api.Controllers /// A containing a . [HttpPost("ForgotPassword/Pin")] [ProducesResponseType(StatusCodes.Status200OK)] - public async Task> ForgotPasswordPin([FromBody] string? pin) + public async Task> ForgotPasswordPin([FromBody, Required] string pin) { var result = await _userManager.RedeemPasswordResetPin(pin).ConfigureAwait(false); return result;