From 46c8fa71dd61fac1c681ad3e18f390347878e21a Mon Sep 17 00:00:00 2001 From: Peter Ombwa Date: Mon, 7 Nov 2022 15:52:07 -0800 Subject: [PATCH] Use indexer to add JsonObject node. --- src/readme.graph.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/readme.graph.md b/src/readme.graph.md index d994cd53395..bf8b54bb9b5 100644 --- a/src/readme.graph.md +++ b/src/readme.graph.md @@ -714,6 +714,21 @@ directive: return $; } +# Modify generated JsonObject class. + - from: source-file-csharp + where: $ + transform: > + if (!$documentPath.match(/generated%5Cruntime%5CNodes%5CJsonObject.cs/gm)) + { + return $; + } else { + // Change how JsonObject adds json node to avoid key conflicts. + let dictionaryAddRegex = /(items\.Add\(\s*name\s*\,\s*value\s*\)\;)/gm + $ = $.replace(dictionaryAddRegex, 'items[name] = value;'); + + return $; + } + # Serialize all $count parameter to lowercase true or false. - from: source-file-csharp where: $