Skip to content

Commit 1664d81

Browse files
authored
Merge pull request #542 from microsoftgraph/bugfixes/ServiceModuleCount
Service Module Response Count
2 parents a11d7b2 + c689d33 commit 1664d81

File tree

1 file changed

+39
-20
lines changed

1 file changed

+39
-20
lines changed

src/readme.graph.md

Lines changed: 39 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,20 @@ directive:
469469
$ = $.replace(complexTypeHintRegex, getExclusionsDynamically + '\n$1$2');
470470
}
471471
472+
return $;
473+
}
474+
# Modify generated .dictionary.cs model classes.
475+
- from: source-file-csharp
476+
where: $
477+
transform: >
478+
if (!$documentPath.match(/generated%5Capi%5CModels%5C\w*\d*.dictionary.cs/gm))
479+
{
480+
return $;
481+
} else {
482+
// Remove Count, Keys, and Values properties from implementations of an IAssociativeArray in models.
483+
let propertiesToRemoveRegex = /^.*Microsoft\.Graph\.PowerShell\.Runtime\.IAssociativeArray<global::System\.Object>\.(Count|Keys|Values).*$/gm
484+
$ = $.replace(propertiesToRemoveRegex, '');
485+
472486
return $;
473487
}
474488
# Modify generated .cs model classes.
@@ -479,30 +493,12 @@ directive:
479493
{
480494
return $;
481495
} else {
482-
// Add new modifier to 'values' properties of classes that derive from an IAssociativeArray. See example https://regex101.com/r/hnX7xO/2.
483-
let valuesPropertiesRegex = /(SerializedName\s*=\s*@"values".*\s*.*)(\s*)(.*Values\s*{\s*get;\s*set;\s*})/gmi
484-
if($.match(valuesPropertiesRegex)) {
485-
$ = $.replace(valuesPropertiesRegex, '$1$2 new $3');
486-
}
487-
488-
// Add new modifier to 'additionalProperties' properties of classes that derive from an IAssociativeArray. See example https://regex101.com/r/hnX7xO/2.
496+
// Add new modifier to 'additionalProperties' properties of classes that implement IAssociativeArray. See example https://regex101.com/r/hnX7xO/2.
489497
let additionalPropertiesRegex = /(SerializedName\s*=\s*@"additionalProperties".*\s*.*)(\s*)(.*AdditionalProperties\s*{\s*get;\s*set;\s*})/gmi
490498
if($.match(additionalPropertiesRegex)) {
491499
$ = $.replace(additionalPropertiesRegex, '$1$2 new $3');
492500
}
493501
494-
// Add new modifier to 'keys' properties of classes that derive from an IAssociativeArray. See example https://regex101.com/r/hnX7xO/2.
495-
let keysRegex = /(SerializedName\s*=\s*@"keys".*\s*.*)(\s*)(.*Keys\s*{\s*get;\s*set;\s*})/gmi
496-
if($.match(keysRegex)) {
497-
$ = $.replace(keysRegex, '$1$2 new $3');
498-
}
499-
500-
// Add new modifier to 'count' properties of classes that derive from an IAssociativeArray. See example https://regex101.com/r/hnX7xO/2.
501-
let countRegex = /(SerializedName\s*=\s*@"count".*\s*.*)(\s*)(.*Count\s*{\s*get;\s*set;\s*})/gmi
502-
if($.match(countRegex)) {
503-
$ = $.replace(countRegex, '$1$2 new $3');
504-
}
505-
506502
let regexPattern = /^\s*public\s*partial\s*class\s*MicrosoftGraph(?<EntityName>.*):$/gm;
507503
let regexArray;
508504
while ((regexArray = regexPattern.exec($)) !== null) {
@@ -637,7 +633,7 @@ directive:
637633
return $;
638634
}
639635
640-
# Modify generated runtime IJsonSerializable class.
636+
# Modify generated runtime IJsonSerializable interface.
641637
- from: source-file-csharp
642638
where: $
643639
transform: >
@@ -651,6 +647,29 @@ directive:
651647
return $;
652648
}
653649
650+
# Modify generated runtime IAssociativeArray interface.
651+
- from: source-file-csharp
652+
where: $
653+
transform: >
654+
if (!$documentPath.match(/generated%5Cruntime%5CIAssociativeArray.cs/gm))
655+
{
656+
return $;
657+
} else {
658+
// Remove Count from IAssociativeArray interface.
659+
let countRegex = /int\s*Count\s*{\s*get;\s*}/gm
660+
$ = $.replace(countRegex, '');
661+
662+
// Remove Keys from IAssociativeArray interface.
663+
let keysRegex = /System\.Collections\.Generic\.IEnumerable<string>\s*Keys\s*{\s*get;\s*}/gm
664+
$ = $.replace(keysRegex, '');
665+
666+
// Remove Values from IAssociativeArray interface.
667+
let valuesRegex = /System\.Collections\.Generic\.IEnumerable<T>\s*Values\s*{\s*get;\s*}/gm
668+
$ = $.replace(valuesRegex, '');
669+
670+
return $;
671+
}
672+
654673
# Serialize all $count parameter to lowercase true or false.
655674
- from: source-file-csharp
656675
where: $

0 commit comments

Comments
 (0)