From 67c6eb310cea89d487a90176cdaf8b6e2817711a Mon Sep 17 00:00:00 2001 From: Lothsahn Date: Mon, 14 Aug 2023 01:51:32 -0400 Subject: [PATCH] Add documentation as to why the query is not changing to 1:n for RequireKeyValueTags --- Facepunch.Steamworks/Structs/UgcQuery.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Facepunch.Steamworks/Structs/UgcQuery.cs b/Facepunch.Steamworks/Structs/UgcQuery.cs index 79893bb..a584d51 100644 --- a/Facepunch.Steamworks/Structs/UgcQuery.cs +++ b/Facepunch.Steamworks/Structs/UgcQuery.cs @@ -191,6 +191,11 @@ public QueryType WithTag( string tag ) public QueryType AddRequiredKeyValueTag(string key, string value) { + // While KeyValueTags are typically a 1:many relationship, calling AddRequiredKeyValueTag more than once in a + // query with the same key results in erasing the previous required value for the same key. For this reason, + // someone who calls this method twice in a row with the same key is probably not getting the behavior they + // expect. Therefore, leaving this a dictionary to cause a key conflict if someone adds multiple required values + // for the same key in the same query. if (requiredKv == null) requiredKv = new Dictionary(); requiredKv.Add(key, value); return this; @@ -317,4 +322,4 @@ private void ApplyReturns(UGCQueryHandle_t handle) #endregion } -} \ No newline at end of file +}