Skip to content

Commit 02af493

Browse files
Microsoft Graph DevX ToolingMicrosoft Graph DevX Tooling
authored andcommitted
Handling of OR preposition needs to be reviewed
1 parent 047cc11 commit 02af493

File tree

1 file changed

+15
-17
lines changed

1 file changed

+15
-17
lines changed

tools/TweakOpenApi.ps1

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ $prepositionReplacements = @{
1616
At = "GraphAPre"
1717
For = "GraphFPre"
1818
Of = "GraphOPre"
19-
Or = "GraphRPre"
19+
#Or = "GraphRPre" Handling of this preposition needs to be reviewed
2020
}
2121

2222
$wordReplacements = @{
@@ -33,26 +33,24 @@ Get-ChildItem -Path $OpenAPIFilesPath | ForEach-Object {
3333
$updatedContent = Get-Content $filePath | ForEach-Object {
3434
if ($_.contains("operationId:")) {
3535
$operationId = $_
36-
#For the OR preposition, we need to check if the operationId contains 'Org' as it is a reserved word.
37-
if (-not($operationId -contains "Org")) {
38-
$wordReplacements.Keys | ForEach-Object {
39-
if ($operationId.EndsWith($_, "CurrentCultureIgnoreCase")) {
40-
$operationId = ($operationId -replace $_, $wordReplacements[$_])
41-
$modified = $true
42-
Write-Debug "$_ -> $operationId".Trim()
43-
}
36+
$wordReplacements.Keys | ForEach-Object {
37+
if ($operationId.EndsWith($_, "CurrentCultureIgnoreCase")) {
38+
$operationId = ($operationId -replace $_, $wordReplacements[$_])
39+
$modified = $true
40+
Write-Debug "$_ -> $operationId".Trim()
4441
}
42+
}
4543

46-
if (($targetOperationIdRegex.Match($_)).Success) {
47-
$prepositionReplacements.Keys | ForEach-Object {
48-
# Replace prepositions with replacement word.
49-
#e.g., 'applications_GetCreatedOnBehalfOfByRef' will be renamed to 'applications_GetCreatedOnBehalfGraphOPreGraphBPreRef'.
50-
$operationId = ($operationId -creplace $_, $prepositionReplacements[$_])
51-
$modified = $true
52-
Write-Debug "$_ -> $operationId".Trim()
53-
}
44+
if (($targetOperationIdRegex.Match($_)).Success) {
45+
$prepositionReplacements.Keys | ForEach-Object {
46+
# Replace prepositions with replacement word.
47+
#e.g., 'applications_GetCreatedOnBehalfOfByRef' will be renamed to 'applications_GetCreatedOnBehalfGraphOPreGraphBPreRef'.
48+
$operationId = ($operationId -creplace $_, $prepositionReplacements[$_])
49+
$modified = $true
50+
Write-Debug "$_ -> $operationId".Trim()
5451
}
5552
}
53+
5654
return $operationId
5755
}
5856

0 commit comments

Comments
 (0)