1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 02:33:02 +08:00

Use better method of forcing serialisation

This commit is contained in:
Dean Herbert 2022-10-28 01:26:10 +09:00
parent 3c4ba6e9fc
commit dcff8a193c

View File

@ -3,7 +3,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Linq; using System.Linq;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Converters; using Newtonsoft.Json.Converters;
@ -45,10 +44,8 @@ namespace osu.Game.Online.API.Requests.Responses
public int MaxCombo { get; set; } public int MaxCombo { get; set; }
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
[JsonProperty("rank")] // ScoreRank is aligned to make 0 equal D. We still want to serialise this (even when DefaultValueHandling.Ignore is used).
// ScoreRank is aligned to make 0 equal D. We still want to serialise this (even when DefaultValueHandling.Ignore is used), [JsonProperty("rank", DefaultValueHandling = DefaultValueHandling.Include)]
// so set the default to an impossible value.
[DefaultValue(null)]
public ScoreRank Rank { get; set; } public ScoreRank Rank { get; set; }
[JsonProperty("started_at")] [JsonProperty("started_at")]