Skip to content

Commit 29062c9

Browse files
committed
Rename additionalPRoperties indexer name in Financials module.
1 parent 59ef775 commit 29062c9

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/Financials/Financials/readme.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,29 @@ title: $(service-name)
3232
subject-prefix: ''
3333

3434
```
35+
36+
### Directives
37+
38+
> see https://github.com/Azure/autorest/blob/master/docs/powershell/directives.md
39+
40+
``` yaml
41+
directive:
42+
# Modify generated .dictionary.cs model classes in Financials module.
43+
- from: source-file-csharp
44+
where: $
45+
transform: >
46+
if (!$documentPath.match(/generated%5Capi%5CModels%5CMicrosoftGraph\w*\d*.dictionary.cs/gm))
47+
{
48+
return $;
49+
} else {
50+
// Rename additionalProperties indexer name in Financials module from Item to EntityItem to avoid property name conflict. salesOrderLine has a property named item.
51+
// See https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/indexers/using-indexers
52+
let indexerRegex = /(^\s*)(public\s*global::System.Object this\[global::System.String index\]\s*{\W.*}$)/gm
53+
$ = $.replace(indexerRegex, '$1[System.Runtime.CompilerServices.IndexerName("EntityItem")]\n$1$2');
54+
return $;
55+
}
56+
```
57+
3558
### Versioning
3659
3760
``` yaml

0 commit comments

Comments
 (0)