|
@@ -1,9 +1,6 @@
|
|
|
using System;
|
|
|
-using System.Collections.Generic;
|
|
|
using System.IO;
|
|
|
-using System.Linq;
|
|
|
using System.Reflection;
|
|
|
-using System.Text.Json.Serialization;
|
|
|
using Jellyfin.Api;
|
|
|
using Jellyfin.Api.Auth;
|
|
|
using Jellyfin.Api.Auth.FirstTimeSetupOrElevatedPolicy;
|
|
@@ -11,6 +8,7 @@ using Jellyfin.Api.Auth.RequiresElevationPolicy;
|
|
|
using Jellyfin.Api.Constants;
|
|
|
using Jellyfin.Api.Controllers;
|
|
|
using Jellyfin.Server.Formatters;
|
|
|
+using MediaBrowser.Common.Json;
|
|
|
using Microsoft.AspNetCore.Authentication;
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
@@ -83,8 +81,20 @@ namespace Jellyfin.Server.Extensions
|
|
|
.AddApplicationPart(typeof(StartupController).Assembly)
|
|
|
.AddJsonOptions(options =>
|
|
|
{
|
|
|
- // Setting the naming policy to null leaves the property names as-is when serializing objects to JSON.
|
|
|
- options.JsonSerializerOptions.PropertyNamingPolicy = null;
|
|
|
+ // Update all properties that are set in JsonDefaults
|
|
|
+ var jsonOptions = JsonDefaults.PascalCase;
|
|
|
+
|
|
|
+ // From JsonDefaults
|
|
|
+ options.JsonSerializerOptions.ReadCommentHandling = jsonOptions.ReadCommentHandling;
|
|
|
+ options.JsonSerializerOptions.WriteIndented = jsonOptions.WriteIndented;
|
|
|
+ options.JsonSerializerOptions.Converters.Clear();
|
|
|
+ foreach (var converter in jsonOptions.Converters)
|
|
|
+ {
|
|
|
+ options.JsonSerializerOptions.Converters.Add(converter);
|
|
|
+ }
|
|
|
+
|
|
|
+ // From JsonDefaults.PascalCase
|
|
|
+ options.JsonSerializerOptions.PropertyNamingPolicy = jsonOptions.PropertyNamingPolicy;
|
|
|
})
|
|
|
.AddControllersAsServices();
|
|
|
}
|
|
@@ -98,7 +108,7 @@ namespace Jellyfin.Server.Extensions
|
|
|
{
|
|
|
return serviceCollection.AddSwaggerGen(c =>
|
|
|
{
|
|
|
- c.SwaggerDoc("api-docs", new OpenApiInfo { Title = "Jellyfin API" });
|
|
|
+ c.SwaggerDoc("api-docs", new OpenApiInfo { Title = "Jellyfin API", Version = "v1" });
|
|
|
|
|
|
// Add all xml doc files to swagger generator.
|
|
|
var xmlFiles = Directory.GetFiles(
|