瀏覽代碼

Merge pull request #4625 from crobibero/api-docs-description

Fix OpenApi generation for BlurHash
Claus Vium 4 年之前
父節點
當前提交
28373504da
共有 1 個文件被更改,包括 9 次插入18 次删除
  1. 9 18
      Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs

+ 9 - 18
Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs

@@ -285,20 +285,17 @@ namespace Jellyfin.Server.Extensions
         private static void AddSwaggerTypeMappings(this SwaggerGenOptions options)
         {
             /*
-             * TODO remove when System.Text.Json supports non-string keys.
-             * Used in Jellyfin.Api.Controller.GetChannels.
+             * TODO remove when System.Text.Json properly supports non-string keys.
+             * Used in BaseItemDto.ImageBlurHashes
              */
             options.MapType<Dictionary<ImageType, string>>(() =>
                 new OpenApiSchema
                 {
                     Type = "object",
-                    Properties = typeof(ImageType).GetEnumNames().ToDictionary(
-                        name => name,
-                        name => new OpenApiSchema
-                        {
-                            Type = "string",
-                            Format = "string"
-                        })
+                    AdditionalProperties = new OpenApiSchema
+                    {
+                        Type = "string"
+                    }
                 });
 
             /*
@@ -312,16 +309,10 @@ namespace Jellyfin.Server.Extensions
                         name => name,
                         name => new OpenApiSchema
                         {
-                            Type = "object", Properties = new Dictionary<string, OpenApiSchema>
+                            Type = "object",
+                            AdditionalProperties = new OpenApiSchema
                             {
-                                {
-                                    "string",
-                                    new OpenApiSchema
-                                    {
-                                        Type = "string",
-                                        Format = "string"
-                                    }
-                                }
+                                Type = "string"
                             }
                         })
                 });