diff options
| author | Cody Robibero <cody@robibe.ro> | 2025-09-23 07:00:34 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-23 07:00:34 -0600 |
| commit | 27047c35a43bf0437d6f215b92485c45b4b355c6 (patch) | |
| tree | 215297525899419792f770ca00f5c0da26a4397b /Jellyfin.Server | |
| parent | 42003ca9d2178be165b7d4c671bbe7084e106e39 (diff) | |
Add schema to 503 headers (#14840)
Diffstat (limited to 'Jellyfin.Server')
| -rw-r--r-- | Jellyfin.Server/Filters/RetryOnTemporarilyUnavailableFilter.cs | 53 |
1 files changed, 34 insertions, 19 deletions
diff --git a/Jellyfin.Server/Filters/RetryOnTemporarilyUnavailableFilter.cs b/Jellyfin.Server/Filters/RetryOnTemporarilyUnavailableFilter.cs index fef5577a1..08caac0d3 100644 --- a/Jellyfin.Server/Filters/RetryOnTemporarilyUnavailableFilter.cs +++ b/Jellyfin.Server/Filters/RetryOnTemporarilyUnavailableFilter.cs @@ -1,6 +1,4 @@ -using System; using System.Collections.Generic; -using System.Net.Http.Headers; using Microsoft.OpenApi.Models; using Swashbuckle.AspNetCore.SwaggerGen; @@ -10,27 +8,44 @@ internal class RetryOnTemporarilyUnavailableFilter : IOperationFilter { public void Apply(OpenApiOperation operation, OperationFilterContext context) { - operation.Responses.Add("503", new OpenApiResponse() - { - Description = "The server is currently starting or is temporarily not available.", - Headers = new Dictionary<string, OpenApiHeader>() + operation.Responses.Add( + "503", + new OpenApiResponse { + Description = "The server is currently starting or is temporarily not available.", + Headers = new Dictionary<string, OpenApiHeader> { - "Retry-After", - new() { AllowEmptyValue = true, Required = false, Description = "A hint for when to retry the operation in full seconds." } + { + "Retry-After", new OpenApiHeader + { + AllowEmptyValue = true, + Required = false, + Description = "A hint for when to retry the operation in full seconds.", + Schema = new OpenApiSchema + { + Type = "integer", + Format = "int32" + } + } + }, + { + "Message", new OpenApiHeader + { + AllowEmptyValue = true, + Required = false, + Description = "A short plain-text reason why the server is not available.", + Schema = new OpenApiSchema + { + Type = "string", + Format = "text" + } + } + } }, + Content = new Dictionary<string, OpenApiMediaType>() { - "Message", - new() { AllowEmptyValue = true, Required = false, Description = "A short plain-text reason why the server is not available." } + { "text/html", new OpenApiMediaType() } } - }, - Content = new Dictionary<string, OpenApiMediaType>() - { - { - "text/html", - new OpenApiMediaType() - } - } - }); + }); } } |
