From 95b8a615549d7b636f6c0d762ff3aa05f05208c8 Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Fri, 23 Feb 2024 00:48:30 +0100 Subject: [PATCH] [backend/masto-client] Fix json-body list endpoint processing --- .../Mastodon/Schemas/ListSchemas.cs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/Iceshrimp.Backend/Controllers/Mastodon/Schemas/ListSchemas.cs b/Iceshrimp.Backend/Controllers/Mastodon/Schemas/ListSchemas.cs index 8982362d..c991cbd4 100644 --- a/Iceshrimp.Backend/Controllers/Mastodon/Schemas/ListSchemas.cs +++ b/Iceshrimp.Backend/Controllers/Mastodon/Schemas/ListSchemas.cs @@ -1,4 +1,6 @@ using B = Microsoft.AspNetCore.Mvc.BindPropertyAttribute; +using J = System.Text.Json.Serialization.JsonPropertyNameAttribute; +using JR = System.Text.Json.Serialization.JsonRequiredAttribute; namespace Iceshrimp.Backend.Controllers.Mastodon.Schemas; @@ -6,13 +8,22 @@ public abstract class ListSchemas { public class ListCreationRequest { - [B(Name = "title")] public required string Title { get; set; } - [B(Name = "replies_policy")] public string RepliesPolicy { get; set; } = "list"; - [B(Name = "exclusive")] public bool Exclusive { get; set; } = false; + [J("title")] [JR] [B(Name = "title")] public required string Title { get; set; } + + [J("replies_policy")] + [B(Name = "replies_policy")] + public string RepliesPolicy { get; set; } = "list"; + + [J("exclusive")] + [B(Name = "exclusive")] + public bool Exclusive { get; set; } = false; } public class ListUpdateMembersRequest { - [B(Name = "account_ids")] public required List AccountIds { get; set; } + [J("account_ids")] + [JR] + [B(Name = "account_ids")] + public required List AccountIds { get; set; } } } \ No newline at end of file