Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/readme.graph.md
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,11 @@ directive:
// Changes excludes hashset to a case-insensitive hashset.
let fromJsonRegex = /(\s*FromJson<\w*>\s*\(JsonObject\s*json\s*,\s*System\.Collections\.Generic\.IDictionary.*)(\s*)({)/gm
$ = $.replace(fromJsonRegex, '$1$2$3\n$2 if (excludes != null){ excludes = new System.Collections.Generic.HashSet<string>(excludes, global::System.StringComparer.OrdinalIgnoreCase);}');

// Serialize DictionaryEntry struct as a value type.
let dictionaryEntrySerializer = 'if (vValue is System.Collections.DictionaryEntry deValue){return new JsonObject { { deValue.Key.ToString(), ToJsonValue(deValue.Value) } };}';
let valueTypeSerializerRegex = /(private\s*static\s*JsonNode\s*ToJsonValue\(ValueType vValue\)\s*{\s*)/gm
$ = $.replace(valueTypeSerializerRegex, `$1 ${dictionaryEntrySerializer}\n`);
return $;
}

Expand Down