aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Common/Json/JsonDefaults.cs
diff options
context:
space:
mode:
authorBond_009 <bond.009@outlook.com>2021-06-19 18:02:33 +0200
committerBond_009 <bond.009@outlook.com>2021-06-19 18:04:46 +0200
commit6f8ccab788e85e025eaa44b67a1487bf419afb53 (patch)
treef8895fae8ec17e922daab473180c9de9a702a02a /MediaBrowser.Common/Json/JsonDefaults.cs
parent0c3dcdf77b0d124517bffa608bfddf7d8f7682db (diff)
Move non-jellyfin extensions to separate project
Diffstat (limited to 'MediaBrowser.Common/Json/JsonDefaults.cs')
-rw-r--r--MediaBrowser.Common/Json/JsonDefaults.cs90
1 files changed, 0 insertions, 90 deletions
diff --git a/MediaBrowser.Common/Json/JsonDefaults.cs b/MediaBrowser.Common/Json/JsonDefaults.cs
deleted file mode 100644
index 405d6125f..000000000
--- a/MediaBrowser.Common/Json/JsonDefaults.cs
+++ /dev/null
@@ -1,90 +0,0 @@
-using System.Text.Json;
-using System.Text.Json.Serialization;
-using MediaBrowser.Common.Json.Converters;
-
-namespace MediaBrowser.Common.Json
-{
- /// <summary>
- /// Helper class for having compatible JSON throughout the codebase.
- /// </summary>
- public static class JsonDefaults
- {
- /// <summary>
- /// Pascal case json profile media type.
- /// </summary>
- public const string PascalCaseMediaType = "application/json; profile=\"PascalCase\"";
-
- /// <summary>
- /// Camel case json profile media type.
- /// </summary>
- public const string CamelCaseMediaType = "application/json; profile=\"CamelCase\"";
-
- /// <summary>
- /// When changing these options, update
- /// Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs
- /// -> AddJellyfinApi
- /// -> AddJsonOptions.
- /// </summary>
- private static readonly JsonSerializerOptions _jsonSerializerOptions = new ()
- {
- ReadCommentHandling = JsonCommentHandling.Disallow,
- WriteIndented = false,
- DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
- NumberHandling = JsonNumberHandling.AllowReadingFromString,
- Converters =
- {
- new JsonGuidConverter(),
- new JsonNullableGuidConverter(),
- new JsonVersionConverter(),
- new JsonStringEnumConverter(),
- new JsonNullableStructConverterFactory(),
- new JsonBoolNumberConverter(),
- new JsonDateTimeConverter(),
- new JsonStringConverter()
- }
- };
-
- private static readonly JsonSerializerOptions _pascalCaseJsonSerializerOptions = new (_jsonSerializerOptions)
- {
- PropertyNamingPolicy = null
- };
-
- private static readonly JsonSerializerOptions _camelCaseJsonSerializerOptions = new (_jsonSerializerOptions)
- {
- PropertyNamingPolicy = JsonNamingPolicy.CamelCase
- };
-
- /// <summary>
- /// Gets the default <see cref="JsonSerializerOptions" /> options.
- /// </summary>
- /// <remarks>
- /// The return value must not be modified.
- /// If the defaults must be modified the author must use the copy constructor.
- /// </remarks>
- /// <returns>The default <see cref="JsonSerializerOptions" /> options.</returns>
- public static JsonSerializerOptions Options
- => _jsonSerializerOptions;
-
- /// <summary>
- /// Gets camelCase json options.
- /// </summary>
- /// <remarks>
- /// The return value must not be modified.
- /// If the defaults must be modified the author must use the copy constructor.
- /// </remarks>
- /// <returns>The camelCase <see cref="JsonSerializerOptions" /> options.</returns>
- public static JsonSerializerOptions CamelCaseOptions
- => _camelCaseJsonSerializerOptions;
-
- /// <summary>
- /// Gets PascalCase json options.
- /// </summary>
- /// <remarks>
- /// The return value must not be modified.
- /// If the defaults must be modified the author must use the copy constructor.
- /// </remarks>
- /// <returns>The PascalCase <see cref="JsonSerializerOptions" /> options.</returns>
- public static JsonSerializerOptions PascalCaseOptions
- => _pascalCaseJsonSerializerOptions;
- }
-}