From 02ddd4c918996f57070d121d5f2b07f300d83284 Mon Sep 17 00:00:00 2001 From: uwaa Date: Wed, 25 Dec 2024 23:34:13 +0000 Subject: [PATCH] pleroma: add JsonConstructor attribs --- Pleroma/ASObject.cs | 5 +++++ Pleroma/Models/Account.cs | 1 + Pleroma/Models/AccountField.cs | 1 + Pleroma/Models/Attachment.cs | 1 + Pleroma/Models/Context.cs | 1 + Pleroma/Models/Hashtag.cs | 1 + Pleroma/Models/Mention.cs | 1 + Pleroma/Models/Relationship.cs | 1 + Pleroma/Models/SearchResults.cs | 1 + Pleroma/Models/Status.cs | 3 +++ 10 files changed, 16 insertions(+) diff --git a/Pleroma/ASObject.cs b/Pleroma/ASObject.cs index 26aefc1..a10e33a 100644 --- a/Pleroma/ASObject.cs +++ b/Pleroma/ASObject.cs @@ -11,6 +11,11 @@ public class ASObject [JsonPropertyName("id")] public string ID { get; set; } = null!; + [JsonConstructor()] + internal ASObject() + { + } + public override string ToString() => ID; public override bool Equals(object? obj) => Equals(obj as ASObject); diff --git a/Pleroma/Models/Account.cs b/Pleroma/Models/Account.cs index d9f1d73..1de85eb 100644 --- a/Pleroma/Models/Account.cs +++ b/Pleroma/Models/Account.cs @@ -53,6 +53,7 @@ public class Account : ASObject } } + [JsonConstructor()] internal Account() { } diff --git a/Pleroma/Models/AccountField.cs b/Pleroma/Models/AccountField.cs index b4ba648..86c6f20 100644 --- a/Pleroma/Models/AccountField.cs +++ b/Pleroma/Models/AccountField.cs @@ -10,6 +10,7 @@ public class AccountField public DateTime? VerifiedAt { get; set; } + [JsonConstructor()] internal AccountField() { } diff --git a/Pleroma/Models/Attachment.cs b/Pleroma/Models/Attachment.cs index 1aab035..3a4d20e 100644 --- a/Pleroma/Models/Attachment.cs +++ b/Pleroma/Models/Attachment.cs @@ -50,6 +50,7 @@ public class Attachment [JsonPropertyName("url")] public string URL { get; set; } = null!; + [JsonConstructor()] internal Attachment() { } diff --git a/Pleroma/Models/Context.cs b/Pleroma/Models/Context.cs index d852204..48f9d40 100644 --- a/Pleroma/Models/Context.cs +++ b/Pleroma/Models/Context.cs @@ -8,6 +8,7 @@ public class Context [JsonPropertyName("descendants")] public Status[] Descendants { get; set; } = null!; + [JsonConstructor()] internal Context() { } diff --git a/Pleroma/Models/Hashtag.cs b/Pleroma/Models/Hashtag.cs index 8f5cdd9..6de0b13 100644 --- a/Pleroma/Models/Hashtag.cs +++ b/Pleroma/Models/Hashtag.cs @@ -14,6 +14,7 @@ public class Hashtag [JsonPropertyName("url")] public string URL { get; set; } = null!; + [JsonConstructor()] internal Hashtag() { } diff --git a/Pleroma/Models/Mention.cs b/Pleroma/Models/Mention.cs index 80cd372..e450b97 100644 --- a/Pleroma/Models/Mention.cs +++ b/Pleroma/Models/Mention.cs @@ -28,6 +28,7 @@ public class Mention [JsonPropertyName("username")] public string Username { get; set; } = null!; + [JsonConstructor()] internal Mention() { } diff --git a/Pleroma/Models/Relationship.cs b/Pleroma/Models/Relationship.cs index b2b8c35..b1d7996 100644 --- a/Pleroma/Models/Relationship.cs +++ b/Pleroma/Models/Relationship.cs @@ -50,6 +50,7 @@ public class Relationship [JsonPropertyName("subscribing")] public bool Subscribing { get; set; } + [JsonConstructor()] internal Relationship() { } diff --git a/Pleroma/Models/SearchResults.cs b/Pleroma/Models/SearchResults.cs index efcd9ce..40fdbeb 100644 --- a/Pleroma/Models/SearchResults.cs +++ b/Pleroma/Models/SearchResults.cs @@ -20,6 +20,7 @@ public class SearchResults [JsonPropertyName("statuses")] public Status[]? Statuses { get; set; } + [JsonConstructor()] internal SearchResults() { } diff --git a/Pleroma/Models/Status.cs b/Pleroma/Models/Status.cs index 84e09bb..a9990ec 100644 --- a/Pleroma/Models/Status.cs +++ b/Pleroma/Models/Status.cs @@ -140,6 +140,7 @@ public class Status : ASObject [JsonIgnore] public string Content => Pleroma?.Content?.Plain ?? HtmlContent; + [JsonConstructor()] internal Status() { } @@ -170,6 +171,7 @@ public class PleromaStatusData [JsonPropertyName("quote_id")] public string? QuoteID { get; set; } + [JsonConstructor()] internal PleromaStatusData() { } @@ -180,6 +182,7 @@ public class PleromaStatusContent [JsonPropertyName("text/plain")] public string Plain { get; set; } = null!; + [JsonConstructor()] internal PleromaStatusContent() { }