From ff75ee91e5e6e3aa48625f06e39dd9940f7ce5c8 Mon Sep 17 00:00:00 2001 From: Ramses Sanchez Hernandez Date: Wed, 21 Oct 2026 18:01:03 -0700 Subject: [PATCH 1/8] Validate reviewed legacy operation-ID migration bridges Keep compatible regex evidence strict by default. Allow explicit complete legacy source-set review through unique method and normalized-path bridges, with exact old/new IDs and verified removed-route evidence. Reject absent selectors, ambiguity, drift, and misleading profile dispositions. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- ...Get-WrapperDirectiveMigrationInventory.ps1 | 162 ++++++++++++++++- ...est-WrapperDirectiveMigrationInventory.ps1 | 163 ++++++++++++++++++ tools/WrapperGenerator/README.md | 50 ++++++ 3 files changed, 371 insertions(+), 4 deletions(-) diff --git a/tools/Get-WrapperDirectiveMigrationInventory.ps1 b/tools/Get-WrapperDirectiveMigrationInventory.ps1 index 22de2fcf2f9..14c9e301762 100644 --- a/tools/Get-WrapperDirectiveMigrationInventory.ps1 +++ b/tools/Get-WrapperDirectiveMigrationInventory.ps1 @@ -10,6 +10,9 @@ selectors live in src//wrapper/_directiveMigrationMap.json and a against exact method/path/operation-ID evidence in both Kiota-compatible profiles. An unavailable compatible profile can be explicitly excluded only while its spec is absent; this is not an assertion that API operations are absent. +An explicit per-profile operationIdSource: Legacy disposition can bridge actual regex-matched +IDs in openApiDocs to exact compatible evidence by unique method/normalized path. Literal +compatible matching remains the default; absent legacy selectors never imply successors. The command is read-only unless -OutputPath is supplied. It never edits module configuration or markdown files. @@ -46,6 +49,7 @@ $ErrorActionPreference = 'Stop' $repoRoot = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path $srcRoot = Join-Path $repoRoot 'src' $specRoot = Join-Path $repoRoot 'openApiDocs_KiotaCompat' +$legacySpecRoot = Join-Path $repoRoot 'openApiDocs' function Get-DirectiveClassification { param([Parameter(Mandatory)][string]$Text) @@ -125,10 +129,11 @@ function Get-ModuleDirectives { function Get-SpecOperations { param( [Parameter(Mandatory)][string]$ModuleName, - [Parameter(Mandatory)][string]$Profile + [Parameter(Mandatory)][string]$Profile, + [string]$Root = $specRoot ) - $path = Join-Path (Join-Path $specRoot $Profile) "$ModuleName.yml" + $path = Join-Path (Join-Path $Root $Profile) "$ModuleName.yml" if (-not (Test-Path $path)) { return @() } $operations = [System.Collections.Generic.List[object]]::new() $currentPath = $null @@ -177,6 +182,134 @@ function Get-OperationIdRegex { return [regex]::new($pattern) } +function Get-NormalizedOperationKey { + param([string]$Method, [string]$Path) + + $normalizedPath = [regex]::Replace($Path, '\{[^}]*\}', '{}').TrimEnd('/').ToLowerInvariant() + return "$($Method.ToUpperInvariant()) $normalizedPath" +} + +function Test-LegacyOperationTranslation { + param( + [object]$Directive, + [object]$ProfileMap, + [string]$ModuleName, + [string]$Profile, + [object[]]$CompatibleOperations + ) + + if ($Directive.Classification -ne 'OperationIdSuppression') { + return "$Profile legacy translation is only supported for OperationIdSuppression" + } + if ([string]::IsNullOrWhiteSpace($ProfileMap.notes)) { + "$Profile legacy translation notes are required" + } + if ($ProfileMap.absenceExpected -cne $false) { + "$Profile legacy translation requires absenceExpected: false, not an API-absence claim" + } + $legacyPath = Join-Path (Join-Path $legacySpecRoot $Profile) "$ModuleName.yml" + $compatiblePath = Join-Path (Join-Path $specRoot $Profile) "$ModuleName.yml" + if (-not (Test-Path $legacyPath) -or -not (Test-Path $compatiblePath)) { + return "$Profile legacy translation requires both same-module/profile legacy and compatible specs" + } + try { + $regex = Get-OperationIdRegex $Directive.Text + } + catch [ArgumentException] { + return "$Profile legacy operation-ID regex cannot be validated: $($_.Exception.Message)" + } + $legacyOperations = @(Get-SpecOperations -ModuleName $ModuleName -Profile $Profile -Root $legacySpecRoot) + $sourceMatches = @($legacyOperations | Where-Object { $regex.IsMatch($_.OperationId) }) + if ($sourceMatches.Count -eq 0) { + return "$Profile original operation-ID regex matches no legacy operations; successors cannot be inferred" + } + $sourceKeys = [System.Collections.Generic.HashSet[string]]::new([StringComparer]::Ordinal) + foreach ($operation in $sourceMatches) { + [void]$sourceKeys.Add("$($operation.Method) $($operation.Path) [$($operation.OperationId)]") + } + $reviewedKeys = [System.Collections.Generic.HashSet[string]]::new([StringComparer]::Ordinal) + $removed = @() + if ($ProfileMap.PSObject.Properties['removedLegacyOperations']) { + if ($ProfileMap.removedLegacyOperations -isnot [array]) { + "$Profile removedLegacyOperations must be an explicit array" + } + else { $removed = $ProfileMap.removedLegacyOperations } + } + $evidence = @( + foreach ($operation in $ProfileMap.operations) { + [pscustomobject]@{ + Method = "$($operation.method)".ToUpperInvariant() + Path = "$($operation.legacyPath)" + OperationId = "$($operation.legacyOperationId)" + CompatiblePath = "$($operation.path)" + Removed = $false + Notes = '' + } + } + foreach ($operation in $removed) { + [pscustomobject]@{ + Method = "$($operation.method)".ToUpperInvariant() + Path = "$($operation.path)" + OperationId = "$($operation.operationId)" + CompatiblePath = '' + Removed = $true + Notes = "$($operation.notes)" + } + } + ) + foreach ($expected in $evidence) { + $key = "$($expected.Method) $($expected.Path) [$($expected.OperationId)]" + if (-not $reviewedKeys.Add($key)) { + "$Profile duplicate legacy evidence '$key'" + } + if (-not $sourceKeys.Contains($key)) { + "$Profile legacy evidence '$key' is not an exact original regex match" + } + $normalizedKey = Get-NormalizedOperationKey $expected.Method $expected.Path + $oldMatches = @($legacyOperations | Where-Object { + (Get-NormalizedOperationKey $_.Method $_.Path) -ceq $normalizedKey + }) + if ($oldMatches.Count -ne 1) { + "$Profile legacy method/normalized path '$normalizedKey' matched $($oldMatches.Count) operations; bridge must be unique" + } + $currentMatches = @($CompatibleOperations | Where-Object { + (Get-NormalizedOperationKey $_.Method $_.Path) -ceq $normalizedKey + }) + if ($expected.Removed) { + if ([string]::IsNullOrWhiteSpace($expected.Notes)) { + "$Profile removed legacy operation '$key' requires review notes" + } + if ($currentMatches.Count -ne 0) { + "$Profile removed legacy operation '$key' still has $($currentMatches.Count) compatible method/normalized-path matches" + } + # A qualified legacy action may survive under its bare name. Do not mistake a + # converter path change for removal; this helper does not yet translate that shape. + $possiblePath = $expected.Path -replace '/microsoft\.graph\.([a-zA-Z_][a-zA-Z0-9_]*(?:\(.*\))?)/?$', '/$1' + $possibleKey = Get-NormalizedOperationKey $expected.Method ($possiblePath -replace '\(\)$', '') + $possibleSuccessors = @($CompatibleOperations | Where-Object { + (Get-NormalizedOperationKey $_.Method ($_.Path -replace '\(\)$', '')) -ceq $possibleKey + }) + if ($currentMatches.Count -eq 0 -and $possibleSuccessors.Count -gt 0) { + "$Profile cannot verify removal of '$key': a qualified/bare or empty-argument compatible counterpart needs reviewed path translation" + } + } + else { + if ([string]::IsNullOrWhiteSpace($expected.Path) -or [string]::IsNullOrWhiteSpace($expected.OperationId)) { + "$Profile legacyPath and legacyOperationId evidence are required" + } + if ((Get-NormalizedOperationKey $expected.Method $expected.CompatiblePath) -cne $normalizedKey) { + "$Profile legacy and compatible method/normalized path must be identical for '$key'" + } + if ($currentMatches.Count -ne 1) { + "$Profile compatible method/normalized path '$normalizedKey' matched $($currentMatches.Count) operations; bridge must be unique" + } + } + } + if (-not $reviewedKeys.SetEquals($sourceKeys)) { + "$Profile legacy evidence must account for the complete original regex match set ($($sourceMatches.Count) operations)" + } +} + if (-not $Module -or $Module.Count -eq 0) { $Module = @(Get-ChildItem $srcRoot -Directory | Where-Object { Test-Path (Join-Path $_.FullName "$($_.Name).md") @@ -265,10 +398,24 @@ foreach ($moduleName in $Module) { $missing.Add("$profile operations must be an explicit array") continue } + $usesLegacyIds = $profileMap.operationIdSource -ceq 'Legacy' + if ($profileMap.PSObject.Properties['operationIdSource'] -and -not $usesLegacyIds) { + $missing.Add("$profile operationIdSource must be 'Legacy' when supplied") + } + if (-not $usesLegacyIds -and ( + $profileMap.PSObject.Properties['removedLegacyOperations'] -or + @($profileMap.operations | Where-Object { + $_.PSObject.Properties['legacyPath'] -or $_.PSObject.Properties['legacyOperationId'] + }).Count -gt 0)) { + $missing.Add("$profile legacy evidence requires explicit operationIdSource: Legacy") + } if ($profileMap.PSObject.Properties['excluded'] -and $profileMap.excluded -isnot [bool]) { $missing.Add("$profile excluded must be a boolean") } if ($profileMap.excluded -is [bool] -and $profileMap.excluded) { + if ($usesLegacyIds) { + $missing.Add("$profile cannot combine exclusion with legacy translation") + } $specPath = Join-Path (Join-Path $specRoot $profile) "$moduleName.yml" if (Test-Path $specPath) { $missing.Add("$profile cannot be excluded because its compatible spec exists") @@ -315,10 +462,17 @@ foreach ($moduleName in $Module) { $profileMatches[$profile] += $matches[0] } } - if (@($profileMap.operations).Count -eq 0 -and -not $profileMap.absenceExpected) { + if (@($profileMap.operations).Count -eq 0 -and -not $profileMap.absenceExpected -and -not $usesLegacyIds) { $missing.Add("$profile has no operations and is not marked absenceExpected") } - if ($directive.Classification -eq 'OperationIdSuppression') { + if ($usesLegacyIds) { + foreach ($issue in @(Test-LegacyOperationTranslation -Directive $directive -ProfileMap $profileMap ` + -ModuleName $moduleName -Profile $profile -CompatibleOperations $operationsByProfile[$profile])) { + $missing.Add($issue) + } + $notes = "$notes $profile reviewed legacy operation-ID translation: $($profileMap.notes)".Trim() + } + elseif ($directive.Classification -eq 'OperationIdSuppression') { try { $regex = Get-OperationIdRegex $directive.Text $candidates = @($operationsByProfile[$profile] | Where-Object { $regex.IsMatch($_.OperationId) }) diff --git a/tools/Test-WrapperDirectiveMigrationInventory.ps1 b/tools/Test-WrapperDirectiveMigrationInventory.ps1 index ea564b012dc..b80d7523373 100644 --- a/tools/Test-WrapperDirectiveMigrationInventory.ps1 +++ b/tools/Test-WrapperDirectiveMigrationInventory.ps1 @@ -281,6 +281,169 @@ paths: throw 'Quoted YAML function keys must resolve exact unescaped method/path/operation-ID evidence.' } + Write-FixtureFile 'src\LegacyBridge\LegacyBridge.md' @' +directive: + - remove-path-by-operation: ^legacy_.*Widget$ +'@ + $legacySpec = @' +openapi: 3.0.4 +paths: + '/widgets/{old-id}': + get: + operationId: legacy_GetWidget + patch: + operationId: legacy_UpdateWidget + '/retired/{old-id}': + delete: + operationId: legacy_DeleteWidget + /unselected: + get: + operationId: unrelated_GetOther +'@ + $currentSpec = @' +openapi: 3.0.4 +paths: + '/widgets/{widget-id}': + get: + operationId: widgets.GetWidget + patch: + operationId: widgets.UpdateWidget + /unselected: + get: + operationId: widgets.GetOther + '/different/{widget-id}': + get: + operationId: widgets.GetDifferent +'@ + Write-FixtureFile 'openApiDocs\v1.0\LegacyBridge.yml' $legacySpec + Write-FixtureFile 'openApiDocs_KiotaCompat\v1.0\LegacyBridge.yml' $currentSpec + $legacyMapping = @' +{ + "mappings": [{ + "module": "LegacyBridge", + "directiveIndex": 1, + "classification": "OperationIdSuppression", + "sourceContains": "remove-path-by-operation: ^legacy_.*Widget$", + "implementation": "CmdletConfigurator", + "profiles": { + "v1.0": { + "operationIdSource": "Legacy", + "notes": "Reviewed exact old/new IDs and method/path bridges; one old operation was pruned.", + "absenceExpected": false, + "operations": [ + { "method": "GET", "path": "/widgets/{widget-id}", "operationId": "widgets.GetWidget", "legacyPath": "/widgets/{old-id}", "legacyOperationId": "legacy_GetWidget" }, + { "method": "PATCH", "path": "/widgets/{widget-id}", "operationId": "widgets.UpdateWidget", "legacyPath": "/widgets/{old-id}", "legacyOperationId": "legacy_UpdateWidget" } + ], + "removedLegacyOperations": [ + { "method": "DELETE", "path": "/retired/{old-id}", "operationId": "legacy_DeleteWidget", "notes": "Actual old route has no compatible method/normalized-path counterpart." } + ] + }, + "beta": { + "excluded": true, + "operations": [], + "notes": "No compatible beta spec; not an API-absence claim." + } + } + }] +} +'@ + Set-Content $testMapping $legacyMapping + $bridged = @(& $fixtureTool -Module LegacyBridge -MappingPath $testMapping -FailOnUnresolved) + if ($bridged[0].Status -ne 'Mapped' -or $bridged[0].V1Operations.Count -ne 2 -or + $bridged[0].BetaOperations.Count -ne 0 -or + $bridged[0].Notes -notmatch 'reviewed legacy operation-ID translation') { + throw 'Reviewed complete legacy-ID bridges must map surviving compatible operations and retain exclusion notes.' + } + $literal = @(& $fixtureTool -Module LegacyBridge) + if ($literal[0].Status -ne 'Unresolved') { + throw 'Legacy specs must never cause automatic compatible regex resolution or inferred successors.' + } + $bridgeCases = @( + @{ Mutate = { param($d) $d.mappings[0].profiles.'v1.0'.PSObject.Properties.Remove('operationIdSource') }; Pattern = 'requires explicit operationIdSource' } + @{ Mutate = { param($d) $d.mappings[0].profiles.'v1.0'.operationIdSource = 'legacy' }; Pattern = "operationIdSource must be 'Legacy'" } + @{ Mutate = { param($d) $d.mappings[0].profiles.'v1.0'.notes = '' }; Pattern = 'legacy translation notes are required' } + @{ Mutate = { param($d) $d.mappings[0].profiles.'v1.0'.absenceExpected = $true }; Pattern = 'requires absenceExpected: false' } + @{ Mutate = { param($d) $d.mappings[0].classification = 'SubjectRename' }; Pattern = 'classification changed|only supported for OperationIdSuppression' } + @{ Mutate = { param($d) $d.mappings[0].profiles.'v1.0'.operations = @($d.mappings[0].profiles.'v1.0'.operations[0]) }; Pattern = 'complete original regex match set' } + @{ Mutate = { param($d) $d.mappings[0].profiles.'v1.0'.PSObject.Properties.Remove('removedLegacyOperations') }; Pattern = 'complete original regex match set' } + @{ Mutate = { param($d) $d.mappings[0].profiles.'v1.0'.operations[0].legacyOperationId = 'legacy_getWidget' }; Pattern = 'not an exact original regex match' } + @{ Mutate = { param($d) $d.mappings[0].profiles.'v1.0'.operations[0].legacyPath = '/Widgets/{old-id}' }; Pattern = 'not an exact original regex match' } + @{ Mutate = { param($d) $d.mappings[0].profiles.'v1.0'.operations[0].PSObject.Properties.Remove('legacyOperationId') }; Pattern = 'legacyPath and legacyOperationId evidence are required' } + @{ Mutate = { param($d) $d.mappings[0].profiles.'v1.0'.operations[0].PSObject.Properties.Remove('legacyPath') }; Pattern = 'legacyPath and legacyOperationId evidence are required' } + @{ Mutate = { param($d) $d.mappings[0].profiles.'v1.0'.operations[0].method = 'POST' }; Pattern = 'matched 0 operations' } + @{ Mutate = { param($d) $d.mappings[0].profiles.'v1.0'.operations[0].path = '/different/{widget-id}'; $d.mappings[0].profiles.'v1.0'.operations[0].operationId = 'widgets.GetDifferent' }; Pattern = 'method/normalized path must be identical' } + @{ Mutate = { param($d) $d.mappings[0].profiles.'v1.0'.operations[0].legacyPath = '/unselected'; $d.mappings[0].profiles.'v1.0'.operations[0].legacyOperationId = 'unrelated_GetOther' }; Pattern = 'not an exact original regex match' } + @{ Mutate = { param($d) $d.mappings[0].profiles.'v1.0'.operations[0].operationId = 'stale.GetWidget' }; Pattern = 'operationId changed' } + @{ Mutate = { param($d) $d.mappings[0].profiles.'v1.0'.operations += $d.mappings[0].profiles.'v1.0'.operations[0] }; Pattern = 'duplicate legacy evidence' } + @{ Mutate = { param($d) $d.mappings[0].profiles.'v1.0'.removedLegacyOperations[0].notes = '' }; Pattern = 'requires review notes' } + @{ Mutate = { param($d) $d.mappings[0].profiles.'v1.0'.removedLegacyOperations[0].operationId = 'unrelated_GetOther' }; Pattern = 'not an exact original regex match' } + @{ Mutate = { param($d) $d.mappings[0].profiles.'v1.0'.removedLegacyOperations = $null }; Pattern = 'removedLegacyOperations must be an explicit array' } + @{ Mutate = { param($d) $d.mappings[0].profiles.'v1.0'.removedLegacyOperations += [pscustomobject]@{method='GET';path='/widgets/{old-id}';operationId='legacy_GetWidget';notes='False removal claim'} }; Pattern = 'still has 1 compatible' } + @{ Mutate = { param($d) $d.mappings[0].profiles.beta | Add-Member operationIdSource 'Legacy' }; Pattern = 'cannot combine exclusion with legacy translation' } + ) + foreach ($case in $bridgeCases) { + $document = $legacyMapping | ConvertFrom-Json + & $case.Mutate $document + $document | ConvertTo-Json -Depth 10 | Set-Content $testMapping + Assert-Failure { & $fixtureTool -Module LegacyBridge -MappingPath $testMapping } $case.Pattern + } + Set-Content $testMapping $legacyMapping + Write-FixtureFile 'openApiDocs\v1.0\LegacyBridge.yml' ($legacySpec -replace 'legacy_', 'changed_') + Assert-Failure { & $fixtureTool -Module LegacyBridge -MappingPath $testMapping } 'matches no legacy operations' + Write-FixtureFile 'openApiDocs\v1.0\LegacyBridge.yml' ($legacySpec + @' + + '/widgets/{ambiguous-id}': + get: + operationId: unrelated_Ambiguous +'@) + Assert-Failure { & $fixtureTool -Module LegacyBridge -MappingPath $testMapping } 'legacy method/normalized path .* matched 2 operations' + Write-FixtureFile 'openApiDocs\v1.0\LegacyBridge.yml' $legacySpec + Write-FixtureFile 'openApiDocs_KiotaCompat\v1.0\LegacyBridge.yml' ($currentSpec + @' + + '/widgets/{ambiguous-id}': + get: + operationId: widgets.Ambiguous +'@) + Assert-Failure { & $fixtureTool -Module LegacyBridge -MappingPath $testMapping } 'compatible method/normalized path .* matched 2 operations' + Write-FixtureFile 'openApiDocs_KiotaCompat\v1.0\LegacyBridge.yml' $currentSpec + Remove-Item (Join-Path $fixtureRoot 'openApiDocs\v1.0\LegacyBridge.yml') + Assert-Failure { & $fixtureTool -Module LegacyBridge -MappingPath $testMapping } 'requires both same-module/profile' + Write-FixtureFile 'openApiDocs\v1.0\LegacyBridge.yml' $legacySpec + Remove-Item (Join-Path $fixtureRoot 'openApiDocs_KiotaCompat\v1.0\LegacyBridge.yml') + Assert-Failure { & $fixtureTool -Module LegacyBridge -MappingPath $testMapping } 'requires both same-module/profile' + Write-FixtureFile 'openApiDocs_KiotaCompat\v1.0\LegacyBridge.yml' "openapi: 3.0.4`npaths: {}" + $document = $legacyMapping | ConvertFrom-Json + foreach ($operation in $document.mappings[0].profiles.'v1.0'.operations) { + $document.mappings[0].profiles.'v1.0'.removedLegacyOperations += [pscustomobject]@{ + method = $operation.method + path = $operation.legacyPath + operationId = $operation.legacyOperationId + notes = 'Reviewed old operation has no current compatible method/path.' + } + } + $document.mappings[0].profiles.'v1.0'.operations = @() + $document | ConvertTo-Json -Depth 10 | Set-Content $testMapping + $removedOnly = @(& $fixtureTool -Module LegacyBridge -MappingPath $testMapping -FailOnUnresolved) + if ($removedOnly[0].Status -ne 'Mapped' -or $removedOnly[0].V1Operations.Count -ne 0) { + throw 'An entirely pruned, fully evidenced legacy match set needs no invented compatible operations.' + } + foreach ($case in @( + @{ OldPath = '/widgets/{old-id}/microsoft.graph.refresh'; NewPath = '/widgets/{widget-id}/refresh'; Method = 'POST' } + @{ OldPath = '/widgets/{old-id}/delta'; NewPath = '/widgets/{widget-id}/delta()'; Method = 'GET' } + )) { + Write-FixtureFile 'openApiDocs\v1.0\LegacyBridge.yml' ($legacySpec + "`n '$($case.OldPath)':`n $($case.Method.ToLowerInvariant()):`n operationId: legacy_ConvertedWidget") + Write-FixtureFile 'openApiDocs_KiotaCompat\v1.0\LegacyBridge.yml' ($currentSpec + "`n '$($case.NewPath)':`n $($case.Method.ToLowerInvariant()):`n operationId: widgets.Converted") + $document = $legacyMapping | ConvertFrom-Json + $document.mappings[0].profiles.'v1.0'.removedLegacyOperations += [pscustomobject]@{ + method = $case.Method + path = $case.OldPath + operationId = 'legacy_ConvertedWidget' + notes = 'False removal claim must not hide a known converter path change.' + } + $document | ConvertTo-Json -Depth 10 | Set-Content $testMapping + Assert-Failure { & $fixtureTool -Module LegacyBridge -MappingPath $testMapping } 'cannot verify removal.*reviewed path translation' + } + Write-FixtureFile 'src\Deferred\Deferred.md' @' ``` yaml directive: diff --git a/tools/WrapperGenerator/README.md b/tools/WrapperGenerator/README.md index 9252e3eecb8..68d0ad3a484 100644 --- a/tools/WrapperGenerator/README.md +++ b/tools/WrapperGenerator/README.md @@ -438,6 +438,56 @@ the shared-directive-only scope. A spec added later invalidates the exclusion un Quoted YAML function keys are decoded before exact path comparison, so doubled single quotes in a key such as `User=''{User}''` become the literal `User='{User}'` in ledger evidence. +### Reviewed legacy operation-ID conversion + +Literal operation-ID matching against compatible specifications remains the default. Some +shared suppression regexes instead name old operation IDs that actually exist in the +same module/profile under `openApiDocs`. Opt into a reviewed translation for that profile, +not an inferred alias or a rewritten regex: + +```json +"v1.0": { + "operationIdSource": "Legacy", + "notes": "Reviewed the complete original legacy regex match set against compatible routes.", + "absenceExpected": false, + "operations": [ + { + "method": "PATCH", + "path": "/auditLogs", + "operationId": "auditLogs.auditLogRoot.UpdateAuditLogRoot", + "legacyPath": "/auditLogs", + "legacyOperationId": "auditLog.auditLogRoot_UpdateAuditLogRoot" + } + ], + "removedLegacyOperations": [] +} +``` + +This disposition is supported only for `OperationIdSuppression`. Both actual +`openApiDocs//.yml` and compatible specifications must exist. The original +shared regex must match at least one legacy operation, and the ledger must account for its +**entire** match set. Each surviving operation needs exact old path/ID and current method/path/ID +evidence. The bridge must be unique by method and normalized path in both specifications; +normalization erases `{parameter}` names, lowercases the path, and trims trailing slashes. +Exact evidence remains case-sensitive. No changed methods, different route shapes, subject +variants, guessed successors, or operations absent from the legacy regex set are inferred. + +If an actual matched legacy operation has been pruned, record its old `method`, `path`, +`operationId`, and review `notes` in `removedLegacyOperations`. This is accepted only when +there are zero current compatible method/normalized-path matches. Surviving and removed +evidence together must cover the complete source set without duplicates. A wholly pruned +source set can have `operations: []` with all entries explicitly reviewed as removed; +`absenceExpected` must still be `false`, not a substitute API-absence assertion. +Translation cannot be combined with profile exclusion. If the regex also matches nothing +in the legacy specification, leave the directive unresolved rather than inventing lineage. +Supplying legacy evidence without the explicit disposition fails. +This bridge does not yet translate qualified-to-bare final action/function segments or +changed empty argument syntax. Potential counterparts such as `microsoft.graph.refresh` +versus `refresh`, or `delta` versus `delta()`, reject a removal claim instead of silently +dropping a surviving operation; they require separately reviewed path-translation support. + +### Completion and audit + Use the existing switch as a **reviewed completion gate** after reconciling a module's ledger: ```powershell From 5312d625b3f0cc11939072d92cd33ab03a2c39c8 Mon Sep 17 00:00:00 2001 From: Ramses Sanchez Hernandez Date: Wed, 21 Oct 2026 18:35:24 -0700 Subject: [PATCH 2/8] Validate explicitly reviewed final-operation path translations Guard final Microsoft Graph qualification removal and function delta spelling by both actual operation kinds, correct HTTP methods, unique exact targets and complete legacy evidence. Keep potential survivors out of removed evidence, index lookups, and isolate completion regressions from migrated live modules. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- ...Get-WrapperDirectiveMigrationInventory.ps1 | 126 +++++++++++++++--- ...est-WrapperDirectiveMigrationInventory.ps1 | 121 ++++++++++++++++- tools/WrapperGenerator/README.md | 20 ++- 3 files changed, 239 insertions(+), 28 deletions(-) diff --git a/tools/Get-WrapperDirectiveMigrationInventory.ps1 b/tools/Get-WrapperDirectiveMigrationInventory.ps1 index 14c9e301762..82b78199f57 100644 --- a/tools/Get-WrapperDirectiveMigrationInventory.ps1 +++ b/tools/Get-WrapperDirectiveMigrationInventory.ps1 @@ -13,6 +13,9 @@ this is not an assertion that API operations are absent. An explicit per-profile operationIdSource: Legacy disposition can bridge actual regex-matched IDs in openApiDocs to exact compatible evidence by unique method/normalized path. Literal compatible matching remains the default; absent legacy selectors never imply successors. +The per-operation legacyPathTranslation: UnqualifyFinalOperation opt-in additionally permits +only reviewed final-operation qualification removal or function delta/delta() spelling, guarded +by both actual operations' kind/method metadata and a unique same-parent counterpart. The command is read-only unless -OutputPath is supplied. It never edits module configuration or markdown files. @@ -138,6 +141,8 @@ function Get-SpecOperations { $operations = [System.Collections.Generic.List[object]]::new() $currentPath = $null $currentMethod = $null + $currentOperation = $null + $currentOperationType = '' foreach ($line in Get-Content $path) { if ($line -match "^\s{2}(?:'(?/.*)'|`"(?/.*)`"|(?/.*)):\s*$") { $currentPath = if ($Matches.ContainsKey('single')) { @@ -147,18 +152,29 @@ function Get-SpecOperations { elseif ($Matches.ContainsKey('double')) { $Matches.double } else { $Matches.plain } $currentMethod = $null + $currentOperation = $null + $currentOperationType = '' continue } if ($currentPath -and $line -match '^\s{4}(?get|post|put|patch|delete|head|options|trace):\s*$') { $currentMethod = $Matches.method.ToUpperInvariant() + $currentOperation = $null + $currentOperationType = '' + continue + } + if (($currentMethod -or $currentOperation) -and $line -match '^\s{6}x-ms-docs-operation-type:\s*(?.+?)\s*$') { + $currentOperationType = $Matches.kind.Trim("'", '"') + if ($currentOperation) { $currentOperation.OperationType = $currentOperationType } continue } if ($currentPath -and $currentMethod -and $line -match '^\s{6}operationId:\s*(?.+?)\s*$') { - $operations.Add([pscustomobject]@{ + $currentOperation = [pscustomobject]@{ Method = $currentMethod Path = $currentPath OperationId = $Matches.id.Trim("'", '"') - }) + OperationType = $currentOperationType + } + $operations.Add($currentOperation) $currentMethod = $null } } @@ -189,6 +205,65 @@ function Get-NormalizedOperationKey { return "$($Method.ToUpperInvariant()) $normalizedPath" } +function Get-FinalOperationKey { + param([string]$Method, [string]$Path) + + $possiblePath = $Path -creplace '/microsoft\.graph\.([a-zA-Z_][a-zA-Z0-9_]*(?:\(.*\))?)/?$', '/$1' + return Get-NormalizedOperationKey $Method ($possiblePath -replace '\(\)$', '') +} + +function Test-FinalOperationTranslation { + param([object]$LegacyOperation, [object]$CompatibleOperation) + + $kind = $LegacyOperation.OperationType + if ($kind -cnotin @('action', 'function') -or $kind -cne $CompatibleOperation.OperationType) { + return 'both actual operations must declare the same action/function kind' + } + $requiredMethod = if ($kind -ceq 'action') { 'POST' } else { 'GET' } + if ($LegacyOperation.Method -cne $requiredMethod -or $CompatibleOperation.Method -cne $requiredMethod) { + return "$kind translation requires HTTP $requiredMethod on both operations" + } + $oldPath = $LegacyOperation.Path.TrimEnd('/') + $newPath = $CompatibleOperation.Path.TrimEnd('/') + $oldSplit = $oldPath.LastIndexOf('/') + $newSplit = $newPath.LastIndexOf('/') + if ((Get-NormalizedOperationKey $requiredMethod $oldPath.Substring(0, $oldSplit)) -cne + (Get-NormalizedOperationKey $requiredMethod $newPath.Substring(0, $newSplit))) { + return 'final-operation translation requires the same normalized parent' + } + $oldTerminal = [regex]::Replace($oldPath.Substring($oldSplit + 1), '\{[^}]*\}', '{}') + $newTerminal = [regex]::Replace($newPath.Substring($newSplit + 1), '\{[^}]*\}', '{}') + $qualified = [regex]::Match($oldTerminal, '^microsoft\.graph\.(?[a-zA-Z_][a-zA-Z0-9_]*(?:\(.*\))?)$') + if ($qualified.Success) { + $bare = $qualified.Groups['bare'].Value + if ($bare -ceq $newTerminal -or + ($kind -ceq 'function' -and ($bare -creplace '\(\)$', '') -ceq ($newTerminal -creplace '\(\)$', ''))) { + return + } + } + elseif ($kind -ceq 'function' -and + (($oldTerminal -ceq 'delta' -and $newTerminal -ceq 'delta()') -or + ($oldTerminal -ceq 'delta()' -and $newTerminal -ceq 'delta'))) { + return + } + return 'only exact final microsoft.graph. qualification removal or function delta/delta() equivalence is supported' +} + +function New-OperationLookup { + param([object[]]$Operations, [switch]$FinalOperation) + + $lookup = [System.Collections.Generic.Dictionary[string, System.Collections.Generic.List[object]]]::new([StringComparer]::Ordinal) + foreach ($operation in $Operations) { + $key = if ($FinalOperation) { Get-FinalOperationKey $operation.Method $operation.Path } + else { Get-NormalizedOperationKey $operation.Method $operation.Path } + if (-not $lookup.ContainsKey($key)) { + $lookup[$key] = [System.Collections.Generic.List[object]]::new() + } + $lookup[$key].Add($operation) + } + return ,$lookup +} + function Test-LegacyOperationTranslation { param( [object]$Directive, @@ -223,6 +298,9 @@ function Test-LegacyOperationTranslation { if ($sourceMatches.Count -eq 0) { return "$Profile original operation-ID regex matches no legacy operations; successors cannot be inferred" } + $legacyLookup = New-OperationLookup $legacyOperations + $compatibleLookup = New-OperationLookup $CompatibleOperations + $finalOperationLookup = New-OperationLookup $CompatibleOperations -FinalOperation $sourceKeys = [System.Collections.Generic.HashSet[string]]::new([StringComparer]::Ordinal) foreach ($operation in $sourceMatches) { [void]$sourceKeys.Add("$($operation.Method) $($operation.Path) [$($operation.OperationId)]") @@ -242,6 +320,7 @@ function Test-LegacyOperationTranslation { Path = "$($operation.legacyPath)" OperationId = "$($operation.legacyOperationId)" CompatiblePath = "$($operation.path)" + Translation = $operation.PSObject.Properties['legacyPathTranslation'] Removed = $false Notes = '' } @@ -252,6 +331,7 @@ function Test-LegacyOperationTranslation { Path = "$($operation.path)" OperationId = "$($operation.operationId)" CompatiblePath = '' + Translation = $operation.PSObject.Properties['legacyPathTranslation'] Removed = $true Notes = "$($operation.notes)" } @@ -266,15 +346,19 @@ function Test-LegacyOperationTranslation { "$Profile legacy evidence '$key' is not an exact original regex match" } $normalizedKey = Get-NormalizedOperationKey $expected.Method $expected.Path - $oldMatches = @($legacyOperations | Where-Object { - (Get-NormalizedOperationKey $_.Method $_.Path) -ceq $normalizedKey - }) + $oldMatches = @() + if ($legacyLookup.ContainsKey($normalizedKey)) { $oldMatches = $legacyLookup[$normalizedKey].ToArray() } if ($oldMatches.Count -ne 1) { "$Profile legacy method/normalized path '$normalizedKey' matched $($oldMatches.Count) operations; bridge must be unique" } - $currentMatches = @($CompatibleOperations | Where-Object { - (Get-NormalizedOperationKey $_.Method $_.Path) -ceq $normalizedKey - }) + $usesFinalTranslation = $expected.Translation -and $expected.Translation.Value -ceq 'UnqualifyFinalOperation' + if ($expected.Translation -and (-not $usesFinalTranslation -or $expected.Removed)) { + "$Profile legacyPathTranslation must be 'UnqualifyFinalOperation' on a surviving operation" + } + $currentKey = if ($usesFinalTranslation) { Get-FinalOperationKey $expected.Method $expected.Path } else { $normalizedKey } + $lookup = if ($usesFinalTranslation) { $finalOperationLookup } else { $compatibleLookup } + $currentMatches = @() + if ($lookup.ContainsKey($currentKey)) { $currentMatches = $lookup[$currentKey].ToArray() } if ($expected.Removed) { if ([string]::IsNullOrWhiteSpace($expected.Notes)) { "$Profile removed legacy operation '$key' requires review notes" @@ -282,13 +366,10 @@ function Test-LegacyOperationTranslation { if ($currentMatches.Count -ne 0) { "$Profile removed legacy operation '$key' still has $($currentMatches.Count) compatible method/normalized-path matches" } - # A qualified legacy action may survive under its bare name. Do not mistake a - # converter path change for removal; this helper does not yet translate that shape. - $possiblePath = $expected.Path -replace '/microsoft\.graph\.([a-zA-Z_][a-zA-Z0-9_]*(?:\(.*\))?)/?$', '/$1' - $possibleKey = Get-NormalizedOperationKey $expected.Method ($possiblePath -replace '\(\)$', '') - $possibleSuccessors = @($CompatibleOperations | Where-Object { - (Get-NormalizedOperationKey $_.Method ($_.Path -replace '\(\)$', '')) -ceq $possibleKey - }) + # Potential converter counterparts block removal even without the translation opt-in. + $possibleKey = Get-FinalOperationKey $expected.Method $expected.Path + $possibleSuccessors = @() + if ($finalOperationLookup.ContainsKey($possibleKey)) { $possibleSuccessors = $finalOperationLookup[$possibleKey].ToArray() } if ($currentMatches.Count -eq 0 -and $possibleSuccessors.Count -gt 0) { "$Profile cannot verify removal of '$key': a qualified/bare or empty-argument compatible counterpart needs reviewed path translation" } @@ -297,7 +378,17 @@ function Test-LegacyOperationTranslation { if ([string]::IsNullOrWhiteSpace($expected.Path) -or [string]::IsNullOrWhiteSpace($expected.OperationId)) { "$Profile legacyPath and legacyOperationId evidence are required" } - if ((Get-NormalizedOperationKey $expected.Method $expected.CompatiblePath) -cne $normalizedKey) { + if ($usesFinalTranslation) { + if ($currentMatches.Count -eq 1 -and $currentMatches[0].Path -cne $expected.CompatiblePath) { + "$Profile legacy path translation must select the exact unique compatible counterpart for '$key'" + } + if ($oldMatches.Count -eq 1 -and $currentMatches.Count -eq 1) { + foreach ($issue in @(Test-FinalOperationTranslation $oldMatches[0] $currentMatches[0])) { + "$Profile legacy path translation for '$key': $issue" + } + } + } + elseif ((Get-NormalizedOperationKey $expected.Method $expected.CompatiblePath) -cne $normalizedKey) { "$Profile legacy and compatible method/normalized path must be identical for '$key'" } if ($currentMatches.Count -ne 1) { @@ -405,7 +496,8 @@ foreach ($moduleName in $Module) { if (-not $usesLegacyIds -and ( $profileMap.PSObject.Properties['removedLegacyOperations'] -or @($profileMap.operations | Where-Object { - $_.PSObject.Properties['legacyPath'] -or $_.PSObject.Properties['legacyOperationId'] + $_.PSObject.Properties['legacyPath'] -or $_.PSObject.Properties['legacyOperationId'] -or + $_.PSObject.Properties['legacyPathTranslation'] }).Count -gt 0)) { $missing.Add("$profile legacy evidence requires explicit operationIdSource: Legacy") } diff --git a/tools/Test-WrapperDirectiveMigrationInventory.ps1 b/tools/Test-WrapperDirectiveMigrationInventory.ps1 index b80d7523373..ebc73020eac 100644 --- a/tools/Test-WrapperDirectiveMigrationInventory.ps1 +++ b/tools/Test-WrapperDirectiveMigrationInventory.ps1 @@ -444,6 +444,106 @@ paths: Assert-Failure { & $fixtureTool -Module LegacyBridge -MappingPath $testMapping } 'cannot verify removal.*reviewed path translation' } + $finalCases = @( + @{ Old = '/widgets/{old-id}/microsoft.graph.refresh'; New = '/widgets/{widget-id}/refresh'; Method = 'POST'; OldKind = 'action'; NewKind = 'action' } + @{ Old = '/widgets/{old-id}/microsoft.graph.delta'; New = '/widgets/{widget-id}/delta()'; Method = 'GET'; OldKind = 'function'; NewKind = 'function' } + @{ Old = '/widgets/{old-id}/microsoft.graph.delta()'; New = '/widgets/{widget-id}/delta'; Method = 'GET'; OldKind = 'function'; NewKind = 'function' } + @{ Old = '/widgets/{old-id}/delta'; New = '/widgets/{widget-id}/delta()'; Method = 'GET'; OldKind = 'function'; NewKind = 'function' } + @{ Old = '/widgets/{old-id}/delta()'; New = '/widgets/{widget-id}/delta'; Method = 'GET'; OldKind = 'function'; NewKind = 'function' } + @{ Old = "/widgets/{old-id}/microsoft.graph.resolve(Input='{old-input}')"; New = "/widgets/{widget-id}/resolve(Input='{input}')"; Method = 'GET'; OldKind = 'function'; NewKind = 'function' } + @{ Old = '/widgets/{old-id}/microsoft.graph.refresh'; New = '/widgets/{widget-id}/refresh'; Method = 'POST'; OldKind = ''; NewKind = 'action'; Error = 'both actual operations must declare the same action/function kind' } + @{ Old = '/widgets/{old-id}/microsoft.graph.refresh'; New = '/widgets/{widget-id}/refresh'; Method = 'POST'; OldKind = 'action'; NewKind = ''; Error = 'both actual operations must declare the same action/function kind' } + @{ Old = '/widgets/{old-id}/microsoft.graph.refresh'; New = '/widgets/{widget-id}/refresh'; Method = 'POST'; OldKind = 'action'; NewKind = 'function'; Error = 'both actual operations must declare the same action/function kind' } + @{ Old = '/widgets/{old-id}/microsoft.graph.user'; New = '/widgets/{widget-id}/user'; Method = 'GET'; OldKind = 'operation'; NewKind = 'operation'; Error = 'both actual operations must declare the same action/function kind' } + @{ Old = '/widgets/{old-id}/microsoft.graph.refresh'; New = '/widgets/{widget-id}/refresh'; Method = 'GET'; OldKind = 'action'; NewKind = 'action'; Error = 'action translation requires HTTP POST' } + @{ Old = '/widgets/{old-id}/microsoft.graph.delta'; New = '/widgets/{widget-id}/delta()'; Method = 'POST'; OldKind = 'function'; NewKind = 'function'; Error = 'function translation requires HTTP GET' } + @{ Old = '/widgets/{old-id}/microsoft.graph.refresh'; New = '/other/{widget-id}/refresh'; Method = 'POST'; OldKind = 'action'; NewKind = 'action'; Error = 'matched 0 operations|exact unique compatible counterpart' } + @{ Old = '/widgets/{old-id}/microsoft.graph.refresh'; New = '/widgets/{widget-id}/renamed'; Method = 'POST'; OldKind = 'action'; NewKind = 'action'; Error = 'matched 0 operations' } + @{ Old = '/widgets/{old-id}/microsoft.graph.refresh'; New = '/widgets/{widget-id}/refresh()'; Method = 'POST'; OldKind = 'action'; NewKind = 'action'; Error = 'only exact final' } + @{ Old = '/widgets/{old-id}/resolve'; New = '/widgets/{widget-id}/resolve()'; Method = 'GET'; OldKind = 'function'; NewKind = 'function'; Error = 'only exact final' } + @{ Old = "/widgets/{old-id}/microsoft.graph.delta(token='{token}')"; New = '/widgets/{widget-id}/delta()'; Method = 'GET'; OldKind = 'function'; NewKind = 'function'; Error = 'matched 0 operations' } + @{ Old = '/widgets/{old-id}/microsoft.graph.group/refresh'; New = '/widgets/{widget-id}/group/refresh'; Method = 'POST'; OldKind = 'action'; NewKind = 'action'; Error = 'matched 0 operations' } + ) + foreach ($case in $finalCases) { + $oldMetadata = if ($case.OldKind) { "`n x-ms-docs-operation-type: $($case.OldKind)" } else { '' } + $newMetadata = if ($case.NewKind) { "`n x-ms-docs-operation-type: $($case.NewKind)" } else { '' } + # Cover operation metadata both before and after operationId. + Write-FixtureFile 'openApiDocs\v1.0\LegacyBridge.yml' ("openapi: 3.0.4`npaths:`n `"$($case.Old)`":`n $($case.Method.ToLowerInvariant()):$oldMetadata`n operationId: legacy_ConvertedWidget") + Write-FixtureFile 'openApiDocs_KiotaCompat\v1.0\LegacyBridge.yml' ("openapi: 3.0.4`npaths:`n `"$($case.New)`":`n $($case.Method.ToLowerInvariant()):`n operationId: widgets.Converted$newMetadata") + $document = $legacyMapping | ConvertFrom-Json + $document.mappings[0].profiles.'v1.0'.removedLegacyOperations = @() + $document.mappings[0].profiles.'v1.0'.operations = @([pscustomobject]@{ + method = $case.Method + path = $case.New + operationId = 'widgets.Converted' + legacyPath = $case.Old + legacyOperationId = 'legacy_ConvertedWidget' + legacyPathTranslation = 'UnqualifyFinalOperation' + }) + $document | ConvertTo-Json -Depth 10 | Set-Content $testMapping + if ($case.Error) { + Assert-Failure { & $fixtureTool -Module LegacyBridge -MappingPath $testMapping } $case.Error + } + else { + $translated = @(& $fixtureTool -Module LegacyBridge -MappingPath $testMapping -FailOnUnresolved) + if ($translated[0].Status -ne 'Mapped' -or $translated[0].V1Operations.Count -ne 1) { + throw 'Explicit kind-guarded final-operation translation must preserve the exact current operation.' + } + $document.mappings[0].profiles.'v1.0'.operations[0].PSObject.Properties.Remove('legacyPathTranslation') + $document | ConvertTo-Json -Depth 10 | Set-Content $testMapping + Assert-Failure { & $fixtureTool -Module LegacyBridge -MappingPath $testMapping } 'method/normalized path must be identical' + } + } + # A target may not substitute a different valid operation for the unique converted route. + Write-FixtureFile 'openApiDocs\v1.0\LegacyBridge.yml' @' +openapi: 3.0.4 +paths: + '/widgets/{old-id}/microsoft.graph.refresh': + post: + operationId: legacy_ConvertedWidget + x-ms-docs-operation-type: action +'@ + $finalCurrentSpec = @' +openapi: 3.0.4 +paths: + '/widgets/{widget-id}/refresh': + post: + operationId: widgets.Converted + x-ms-docs-operation-type: action + '/other/{widget-id}/refresh': + post: + operationId: other.Refresh + x-ms-docs-operation-type: action +'@ + Write-FixtureFile 'openApiDocs_KiotaCompat\v1.0\LegacyBridge.yml' $finalCurrentSpec + $document = $legacyMapping | ConvertFrom-Json + $document.mappings[0].profiles.'v1.0'.removedLegacyOperations = @() + $document.mappings[0].profiles.'v1.0'.operations = @([pscustomobject]@{ + method = 'POST' + path = '/other/{widget-id}/refresh' + operationId = 'other.Refresh' + legacyPath = '/widgets/{old-id}/microsoft.graph.refresh' + legacyOperationId = 'legacy_ConvertedWidget' + legacyPathTranslation = 'UnqualifyFinalOperation' + }) + $document | ConvertTo-Json -Depth 10 | Set-Content $testMapping + Assert-Failure { & $fixtureTool -Module LegacyBridge -MappingPath $testMapping } 'exact unique compatible counterpart' + $document.mappings[0].profiles.'v1.0'.operations[0].path = '/widgets/{widget-id}/refresh' + $document.mappings[0].profiles.'v1.0'.operations[0].operationId = 'widgets.Converted' + $document | ConvertTo-Json -Depth 10 | Set-Content $testMapping + Write-FixtureFile 'openApiDocs_KiotaCompat\v1.0\LegacyBridge.yml' ($finalCurrentSpec + @' + + '/widgets/{ambiguous-id}/refresh': + post: + operationId: widgets.AmbiguousRefresh + x-ms-docs-operation-type: action +'@) + Assert-Failure { & $fixtureTool -Module LegacyBridge -MappingPath $testMapping } 'matched 2 operations' + Write-FixtureFile 'openApiDocs_KiotaCompat\v1.0\LegacyBridge.yml' $finalCurrentSpec + $document.mappings[0].profiles.'v1.0'.operations[0].legacyPathTranslation = 'GenericAlias' + $document | ConvertTo-Json -Depth 10 | Set-Content $testMapping + Assert-Failure { & $fixtureTool -Module LegacyBridge -MappingPath $testMapping } "legacyPathTranslation must be 'UnqualifyFinalOperation'" + Write-FixtureFile 'src\Deferred\Deferred.md' @' ``` yaml directive: @@ -479,16 +579,23 @@ directive: $document | ConvertTo-Json -Depth 10 | Set-Content $testMapping Assert-Failure { & $fixtureTool -Module Audit -MappingPath $testMapping -FailOnUnresolved } 'entries do not match a directive' - $applications = @((& $tool -Module Applications -AsJson | Out-String) | ConvertFrom-Json) + Write-FixtureFile 'src\Applications\Applications.md' @' +directive: + - where: + verb: Get + subject: UnreviewedFixture + remove: true + - where: + parameter-name: Id + set: + alias: FixtureId +'@ + $applications = @((& $fixtureTool -Module Applications -AsJson | Out-String) | ConvertFrom-Json) if (@($applications | Where-Object Status -eq 'Deferred').Count -lt 1 -or @($applications | Where-Object Status -eq 'Unresolved').Count -lt 1) { - throw 'Live Applications must retain deferred and unresolved shared directives.' - } - $calendar = @(& $tool -Module Calendar) - if (@($calendar | Where-Object { $_.Status -eq 'Resolved' -and $_.Implementation -eq 'Candidate' }).Count -lt 1) { - throw 'Live Calendar operation-ID matches must remain candidates without reviewed evidence.' + throw 'An unreviewed fixture must expose deferred and unresolved shared directives.' } - Assert-Failure { & $tool -Module Calendar -FailOnUnresolved } 'lack reviewed mappings' + Assert-Failure { & $fixtureTool -Module Applications -FailOnUnresolved } 'lack reviewed mappings' $schemaDirective = @(& $tool -Module Identity.SignIns) | Where-Object Classification -eq 'DeferredSchema' if (@($schemaDirective).Count -ne 1 -or $schemaDirective.Status -ne 'Deferred') { throw 'Live schema/response directives must remain deferred.' diff --git a/tools/WrapperGenerator/README.md b/tools/WrapperGenerator/README.md index 68d0ad3a484..ff09791c294 100644 --- a/tools/WrapperGenerator/README.md +++ b/tools/WrapperGenerator/README.md @@ -481,10 +481,22 @@ source set can have `operations: []` with all entries explicitly reviewed as rem Translation cannot be combined with profile exclusion. If the regex also matches nothing in the legacy specification, leave the directive unresolved rather than inventing lineage. Supplying legacy evidence without the explicit disposition fails. -This bridge does not yet translate qualified-to-bare final action/function segments or -changed empty argument syntax. Potential counterparts such as `microsoft.graph.refresh` -versus `refresh`, or `delta` versus `delta()`, reject a removal claim instead of silently -dropping a surviving operation; they require separately reviewed path-translation support. +For a reviewed final-operation converter change, add +`"legacyPathTranslation": "UnqualifyFinalOperation"` to that **surviving operation** record. +The exact old and new paths/IDs remain mandatory. This opt-in permits only: + +- Final `microsoft.graph.` to bare ``, under the same normalized parent. + Function spelling may additionally differ by an empty `()` suffix; nonempty arguments must + remain identical apart from placeholder names. +- Bare `delta` to `delta()` or the reverse, only for an actual function. + +Both specifications must explicitly declare the same `x-ms-docs-operation-type` (`action` or +`function`), with POST for actions and GET for functions. The compatible counterpart must be +unique, and every original legacy regex match still needs complete accounting. No resource +or cast conversion, earlier path-segment rewrite, generic alias, changed argument shape, or +variant expansion is accepted. Unknown translation names fail rather than being ignored. +Potential qualified/bare or empty-argument counterparts reject a removal claim even without +the opt-in, so a surviving operation cannot be silently reclassified as removed. ### Completion and audit From 9cc0447823527799e04e362c2501bb9b2d81a5fc Mon Sep 17 00:00:00 2001 From: Ramses Sanchez Hernandez Date: Wed, 21 Oct 2026 18:36:27 -0700 Subject: [PATCH 3/8] Clarify isolated inventory regression scope Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- tools/Test-WrapperDirectiveMigrationInventory.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/Test-WrapperDirectiveMigrationInventory.ps1 b/tools/Test-WrapperDirectiveMigrationInventory.ps1 index ebc73020eac..d466d34f8c6 100644 --- a/tools/Test-WrapperDirectiveMigrationInventory.ps1 +++ b/tools/Test-WrapperDirectiveMigrationInventory.ps1 @@ -5,7 +5,7 @@ Validates reviewed directive mappings and the completion gate using isolated fix .DESCRIPTION Copies the inventory tool and preserved Compliance pilot inputs into a temporary repository layout. Exact fixture specifications exercise valid and stale evidence independently of live -API pruning. Also checks read-only live candidate, deferred, and empty-module inventory. +API pruning. Also checks read-only live deferred and empty-module inventory. This is not a claim that every live module ledger passes; audit those modules separately. #> [CmdletBinding()] From 90756627986e1c8b2cfe328fe44acd7230e73d04 Mon Sep 17 00:00:00 2001 From: Ramses Sanchez Hernandez Date: Wed, 21 Oct 2026 18:55:24 -0700 Subject: [PATCH 4/8] Normalize trailing slashes before final-operation comparison Prevent false removed-legacy claims for delta()/ and qualified operation paths. Pin positive translations and negative removals with trailing slashes on either specification while preserving exact evidence and kind/method guards. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- tools/Get-WrapperDirectiveMigrationInventory.ps1 | 2 +- tools/Test-WrapperDirectiveMigrationInventory.ps1 | 7 +++++++ tools/WrapperGenerator/README.md | 2 ++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/tools/Get-WrapperDirectiveMigrationInventory.ps1 b/tools/Get-WrapperDirectiveMigrationInventory.ps1 index 82b78199f57..c9515642e89 100644 --- a/tools/Get-WrapperDirectiveMigrationInventory.ps1 +++ b/tools/Get-WrapperDirectiveMigrationInventory.ps1 @@ -208,7 +208,7 @@ function Get-NormalizedOperationKey { function Get-FinalOperationKey { param([string]$Method, [string]$Path) - $possiblePath = $Path -creplace '/microsoft\.graph\.([a-zA-Z_][a-zA-Z0-9_]*(?:\(.*\))?)/?$', '/$1' + $possiblePath = $Path.TrimEnd('/') -creplace '/microsoft\.graph\.([a-zA-Z_][a-zA-Z0-9_]*(?:\(.*\))?)$', '/$1' return Get-NormalizedOperationKey $Method ($possiblePath -replace '\(\)$', '') } diff --git a/tools/Test-WrapperDirectiveMigrationInventory.ps1 b/tools/Test-WrapperDirectiveMigrationInventory.ps1 index d466d34f8c6..0db35ba4c81 100644 --- a/tools/Test-WrapperDirectiveMigrationInventory.ps1 +++ b/tools/Test-WrapperDirectiveMigrationInventory.ps1 @@ -430,6 +430,9 @@ paths: foreach ($case in @( @{ OldPath = '/widgets/{old-id}/microsoft.graph.refresh'; NewPath = '/widgets/{widget-id}/refresh'; Method = 'POST' } @{ OldPath = '/widgets/{old-id}/delta'; NewPath = '/widgets/{widget-id}/delta()'; Method = 'GET' } + @{ OldPath = '/widgets/{old-id}/delta'; NewPath = '/widgets/{widget-id}/delta()/'; Method = 'GET' } + @{ OldPath = '/widgets/{old-id}/delta()/'; NewPath = '/widgets/{widget-id}/delta/'; Method = 'GET' } + @{ OldPath = '/widgets/{old-id}/microsoft.graph.delta()//'; NewPath = '/widgets/{widget-id}/delta//'; Method = 'GET' } )) { Write-FixtureFile 'openApiDocs\v1.0\LegacyBridge.yml' ($legacySpec + "`n '$($case.OldPath)':`n $($case.Method.ToLowerInvariant()):`n operationId: legacy_ConvertedWidget") Write-FixtureFile 'openApiDocs_KiotaCompat\v1.0\LegacyBridge.yml' ($currentSpec + "`n '$($case.NewPath)':`n $($case.Method.ToLowerInvariant()):`n operationId: widgets.Converted") @@ -450,6 +453,10 @@ paths: @{ Old = '/widgets/{old-id}/microsoft.graph.delta()'; New = '/widgets/{widget-id}/delta'; Method = 'GET'; OldKind = 'function'; NewKind = 'function' } @{ Old = '/widgets/{old-id}/delta'; New = '/widgets/{widget-id}/delta()'; Method = 'GET'; OldKind = 'function'; NewKind = 'function' } @{ Old = '/widgets/{old-id}/delta()'; New = '/widgets/{widget-id}/delta'; Method = 'GET'; OldKind = 'function'; NewKind = 'function' } + @{ Old = '/widgets/{old-id}/delta'; New = '/widgets/{widget-id}/delta()/'; Method = 'GET'; OldKind = 'function'; NewKind = 'function' } + @{ Old = '/widgets/{old-id}/delta()/'; New = '/widgets/{widget-id}/delta/'; Method = 'GET'; OldKind = 'function'; NewKind = 'function' } + @{ Old = '/widgets/{old-id}/microsoft.graph.delta()//'; New = '/widgets/{widget-id}/delta//'; Method = 'GET'; OldKind = 'function'; NewKind = 'function' } + @{ Old = '/widgets/{old-id}/microsoft.graph.refresh//'; New = '/widgets/{widget-id}/refresh/'; Method = 'POST'; OldKind = 'action'; NewKind = 'action' } @{ Old = "/widgets/{old-id}/microsoft.graph.resolve(Input='{old-input}')"; New = "/widgets/{widget-id}/resolve(Input='{input}')"; Method = 'GET'; OldKind = 'function'; NewKind = 'function' } @{ Old = '/widgets/{old-id}/microsoft.graph.refresh'; New = '/widgets/{widget-id}/refresh'; Method = 'POST'; OldKind = ''; NewKind = 'action'; Error = 'both actual operations must declare the same action/function kind' } @{ Old = '/widgets/{old-id}/microsoft.graph.refresh'; New = '/widgets/{widget-id}/refresh'; Method = 'POST'; OldKind = 'action'; NewKind = ''; Error = 'both actual operations must declare the same action/function kind' } diff --git a/tools/WrapperGenerator/README.md b/tools/WrapperGenerator/README.md index ff09791c294..f153f0edbde 100644 --- a/tools/WrapperGenerator/README.md +++ b/tools/WrapperGenerator/README.md @@ -497,6 +497,8 @@ or cast conversion, earlier path-segment rewrite, generic alias, changed argumen variant expansion is accepted. Unknown translation names fail rather than being ignored. Potential qualified/bare or empty-argument counterparts reject a removal claim even without the opt-in, so a surviving operation cannot be silently reclassified as removed. +Trailing slashes on both paths are trimmed before terminal qualification or empty-argument +comparison; the exact recorded paths and IDs are still validated against their specifications. ### Completion and audit From 57f84b15a2bf72a174d96a504fd14a32bf6ffa0d Mon Sep 17 00:00:00 2001 From: Ramses Sanchez Hernandez Date: Wed, 21 Oct 2026 19:36:53 -0700 Subject: [PATCH 5/8] Distinguish reviewed selector absence from legacy inference Clarify existing zero-match default audit behavior without changing helper validation or allowing fabricated Legacy successors. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- tools/WrapperGenerator/README.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tools/WrapperGenerator/README.md b/tools/WrapperGenerator/README.md index f153f0edbde..07c685cc2ab 100644 --- a/tools/WrapperGenerator/README.md +++ b/tools/WrapperGenerator/README.md @@ -408,9 +408,10 @@ For each reviewed directive: `profiles`, each with an explicit `operations` array and boolean `absenceExpected` unless explicitly excluded for a missing compatible specification as described below. Every operation needs exact `method`, case-sensitive `path`, and case-sensitive `operationId` - evidence from that profile. An absent profile requires `operations: []` and - `absenceExpected: true`; it cannot also declare operations. Operation-ID suppressions must - cover exactly the regex's matched operation set in each profile, not a reviewed subset. + evidence from that profile. A present profile with no selected operations requires + `operations: []` and `absenceExpected: true`; it cannot also declare operations. + Operation-ID suppressions must cover exactly the regex's matched operation set in each + profile, not a reviewed subset. Both profiles may declare reviewed absence when neither has matching operations. 2. Add only configuration the wrapper naming rules cannot already produce. Pin structural naming behavior in `NamingTests` instead of adding redundant overrides. @@ -478,8 +479,11 @@ there are zero current compatible method/normalized-path matches. Surviving and evidence together must cover the complete source set without duplicates. A wholly pruned source set can have `operations: []` with all entries explicitly reviewed as removed; `absenceExpected` must still be `false`, not a substitute API-absence assertion. -Translation cannot be combined with profile exclusion. If the regex also matches nothing -in the legacy specification, leave the directive unresolved rather than inventing lineage. +Translation cannot be combined with profile exclusion. If the original regex matches nothing +in the legacy specification, do not use `Legacy` or infer successor operations. An independently +reviewed **default literal no-match audit** can still be `Mapped` with `operations: []`, +`absenceExpected: true`, and no Legacy fields. Notes and module tests must distinguish selector +absence from API-operation absence. Without that review, the directive remains `Unresolved`. Supplying legacy evidence without the explicit disposition fails. For a reviewed final-operation converter change, add `"legacyPathTranslation": "UnqualifyFinalOperation"` to that **surviving operation** record. From a1234d215b84157025480296b9649565cc078551 Mon Sep 17 00:00:00 2001 From: Ramses Sanchez Hernandez Date: Thu, 29 Oct 2026 18:30:11 -0700 Subject: [PATCH 6/8] Revalidate directive inventory after operation-ID alignment Pin aligned literal and reviewed source-set behavior on the current target. Update guidance with the remaining actual Enrollment and Planner qualified-operation gaps without changing helper guards, module ledgers, or generator APIs. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- ...est-WrapperDirectiveMigrationInventory.ps1 | 29 +++++++++++++++ tools/WrapperGenerator/README.md | 37 +++++++++++++------ 2 files changed, 54 insertions(+), 12 deletions(-) diff --git a/tools/Test-WrapperDirectiveMigrationInventory.ps1 b/tools/Test-WrapperDirectiveMigrationInventory.ps1 index 0db35ba4c81..8a1d4a36c21 100644 --- a/tools/Test-WrapperDirectiveMigrationInventory.ps1 +++ b/tools/Test-WrapperDirectiveMigrationInventory.ps1 @@ -358,6 +358,35 @@ paths: if ($literal[0].Status -ne 'Unresolved') { throw 'Legacy specs must never cause automatic compatible regex resolution or inferred successors.' } + $alignedSpec = $currentSpec.Replace('widgets.GetWidget', 'legacy_GetWidget'). + Replace('widgets.UpdateWidget', 'legacy_UpdateWidget') + Write-FixtureFile 'openApiDocs_KiotaCompat\v1.0\LegacyBridge.yml' $alignedSpec + $alignedMapping = $legacyMapping | ConvertFrom-Json + foreach ($operation in $alignedMapping.mappings[0].profiles.'v1.0'.operations) { + $operation.operationId = $operation.legacyOperationId + } + $alignedMapping | ConvertTo-Json -Depth 10 | Set-Content $testMapping + $aligned = @(& $fixtureTool -Module LegacyBridge -MappingPath $testMapping -FailOnUnresolved) + if ($aligned[0].Status -ne 'Mapped' -or $aligned[0].V1Operations.Count -ne 2) { + throw 'Reviewed Legacy source coverage must remain valid when compatible operation IDs are aligned.' + } + $alignedMapping.mappings[0].profiles.'v1.0'.PSObject.Properties.Remove('operationIdSource') + $alignedMapping.mappings[0].profiles.'v1.0'.PSObject.Properties.Remove('removedLegacyOperations') + foreach ($operation in $alignedMapping.mappings[0].profiles.'v1.0'.operations) { + $operation.PSObject.Properties.Remove('legacyPath') + $operation.PSObject.Properties.Remove('legacyOperationId') + } + $alignedMapping | ConvertTo-Json -Depth 10 | Set-Content $testMapping + $literalReviewed = @(& $fixtureTool -Module LegacyBridge -MappingPath $testMapping -FailOnUnresolved) + if ($literalReviewed[0].Status -ne 'Mapped' -or $literalReviewed[0].V1Operations.Count -ne 2) { + throw 'Aligned literal selectors must not require Legacy translation for their complete current match set.' + } + $alignedCandidate = @(& $fixtureTool -Module LegacyBridge) + if ($alignedCandidate[0].Status -ne 'Resolved' -or $alignedCandidate[0].Implementation -ne 'Candidate') { + throw 'Aligned operation IDs alone must not count as reviewed completion.' + } + Assert-Failure { & $fixtureTool -Module LegacyBridge -FailOnUnresolved } 'lack reviewed mappings' + Write-FixtureFile 'openApiDocs_KiotaCompat\v1.0\LegacyBridge.yml' $currentSpec $bridgeCases = @( @{ Mutate = { param($d) $d.mappings[0].profiles.'v1.0'.PSObject.Properties.Remove('operationIdSource') }; Pattern = 'requires explicit operationIdSource' } @{ Mutate = { param($d) $d.mappings[0].profiles.'v1.0'.operationIdSource = 'legacy' }; Pattern = "operationIdSource must be 'Legacy'" } diff --git a/tools/WrapperGenerator/README.md b/tools/WrapperGenerator/README.md index 3f61ab8dea7..55cd93be025 100644 --- a/tools/WrapperGenerator/README.md +++ b/tools/WrapperGenerator/README.md @@ -456,31 +456,44 @@ the shared-directive-only scope. A spec added later invalidates the exclusion un Quoted YAML function keys are decoded before exact path comparison, so doubled single quotes in a key such as `User=''{User}''` become the literal `User='{User}'` in ledger evidence. -### Reviewed legacy operation-ID conversion - -Literal operation-ID matching against compatible specifications remains the default. Some -shared suppression regexes instead name old operation IDs that actually exist in the -same module/profile under `openApiDocs`. Opt into a reviewed translation for that profile, -not an inferred alias or a rewritten regex: +### Reviewed legacy source coverage after operation-ID alignment + +Literal operation-ID matching against compatible specifications remains the default. +Compatible downloads now project the singularized PowerShell operation IDs while retaining +the Plain schemas (`tools/Utilities/Set-OpenApiOperationIds.ps1`). An older dotted compatible +ID is no longer valid ledger evidence merely because it was correct before alignment. +Use current exact method/path/ID evidence; ordinary aligned selectors need no Legacy opt-in. + +Alignment does not guarantee that the original shared regex selects every surviving route. +For example, the beta Enrollment selector matches eight compatible IDs but eleven actual +legacy operations; Planner beta matches 182 compatible IDs but 206 legacy operations. +The remaining three and 24 routes have reviewed final-operation path conversions and +different operation-ID ancestry. Explicit complete-source validation is still required +for those cases. Opt into the same module/profile's actual `openApiDocs` source set, +not an inferred alias, a rewritten regex, or a union with literal compatible matches: ```json -"v1.0": { +"beta": { "operationIdSource": "Legacy", "notes": "Reviewed the complete original legacy regex match set against compatible routes.", "absenceExpected": false, "operations": [ { - "method": "PATCH", - "path": "/auditLogs", - "operationId": "auditLogs.auditLogRoot.UpdateAuditLogRoot", - "legacyPath": "/auditLogs", - "legacyOperationId": "auditLog.auditLogRoot_UpdateAuditLogRoot" + "method": "GET", + "path": "/planner/buckets/{plannerBucket-id}/tasks/delta()", + "operationId": "planner.bucket.plannerBucket.task_delta", + "legacyPath": "/planner/buckets/{plannerBucket-id}/tasks/microsoft.graph.delta()", + "legacyOperationId": "planner.bucket.task_delta", + "legacyPathTranslation": "UnqualifyFinalOperation" } ], "removedLegacyOperations": [] } ``` +This is one real beta Planner bridge, not its complete suppression ledger; all selected +source operations must be included before the completion gate can pass. + This disposition is supported only for `OperationIdSuppression`. Both actual `openApiDocs//.yml` and compatible specifications must exist. The original shared regex must match at least one legacy operation, and the ledger must account for its From 2840ffb441346bee8424c4d7d226d3ae2c884f26 Mon Sep 17 00:00:00 2001 From: Ramses Sanchez Hernandez Date: Mon, 2 Nov 2026 12:24:36 -0800 Subject: [PATCH 7/8] Remove proposed Legacy inventory integration Restore the current target's ordinary literal inventory, tests and documentation in response to the user-directed narrow operation-ID alignment revision. Preserve all published history and existing target behavior. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- ...Get-WrapperDirectiveMigrationInventory.ps1 | 258 +------------- ...est-WrapperDirectiveMigrationInventory.ps1 | 322 +----------------- tools/WrapperGenerator/README.md | 87 +---- 3 files changed, 17 insertions(+), 650 deletions(-) diff --git a/tools/Get-WrapperDirectiveMigrationInventory.ps1 b/tools/Get-WrapperDirectiveMigrationInventory.ps1 index c9515642e89..22de2fcf2f9 100644 --- a/tools/Get-WrapperDirectiveMigrationInventory.ps1 +++ b/tools/Get-WrapperDirectiveMigrationInventory.ps1 @@ -10,12 +10,6 @@ selectors live in src//wrapper/_directiveMigrationMap.json and a against exact method/path/operation-ID evidence in both Kiota-compatible profiles. An unavailable compatible profile can be explicitly excluded only while its spec is absent; this is not an assertion that API operations are absent. -An explicit per-profile operationIdSource: Legacy disposition can bridge actual regex-matched -IDs in openApiDocs to exact compatible evidence by unique method/normalized path. Literal -compatible matching remains the default; absent legacy selectors never imply successors. -The per-operation legacyPathTranslation: UnqualifyFinalOperation opt-in additionally permits -only reviewed final-operation qualification removal or function delta/delta() spelling, guarded -by both actual operations' kind/method metadata and a unique same-parent counterpart. The command is read-only unless -OutputPath is supplied. It never edits module configuration or markdown files. @@ -52,7 +46,6 @@ $ErrorActionPreference = 'Stop' $repoRoot = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path $srcRoot = Join-Path $repoRoot 'src' $specRoot = Join-Path $repoRoot 'openApiDocs_KiotaCompat' -$legacySpecRoot = Join-Path $repoRoot 'openApiDocs' function Get-DirectiveClassification { param([Parameter(Mandatory)][string]$Text) @@ -132,17 +125,14 @@ function Get-ModuleDirectives { function Get-SpecOperations { param( [Parameter(Mandatory)][string]$ModuleName, - [Parameter(Mandatory)][string]$Profile, - [string]$Root = $specRoot + [Parameter(Mandatory)][string]$Profile ) - $path = Join-Path (Join-Path $Root $Profile) "$ModuleName.yml" + $path = Join-Path (Join-Path $specRoot $Profile) "$ModuleName.yml" if (-not (Test-Path $path)) { return @() } $operations = [System.Collections.Generic.List[object]]::new() $currentPath = $null $currentMethod = $null - $currentOperation = $null - $currentOperationType = '' foreach ($line in Get-Content $path) { if ($line -match "^\s{2}(?:'(?/.*)'|`"(?/.*)`"|(?/.*)):\s*$") { $currentPath = if ($Matches.ContainsKey('single')) { @@ -152,29 +142,18 @@ function Get-SpecOperations { elseif ($Matches.ContainsKey('double')) { $Matches.double } else { $Matches.plain } $currentMethod = $null - $currentOperation = $null - $currentOperationType = '' continue } if ($currentPath -and $line -match '^\s{4}(?get|post|put|patch|delete|head|options|trace):\s*$') { $currentMethod = $Matches.method.ToUpperInvariant() - $currentOperation = $null - $currentOperationType = '' - continue - } - if (($currentMethod -or $currentOperation) -and $line -match '^\s{6}x-ms-docs-operation-type:\s*(?.+?)\s*$') { - $currentOperationType = $Matches.kind.Trim("'", '"') - if ($currentOperation) { $currentOperation.OperationType = $currentOperationType } continue } if ($currentPath -and $currentMethod -and $line -match '^\s{6}operationId:\s*(?.+?)\s*$') { - $currentOperation = [pscustomobject]@{ + $operations.Add([pscustomobject]@{ Method = $currentMethod Path = $currentPath OperationId = $Matches.id.Trim("'", '"') - OperationType = $currentOperationType - } - $operations.Add($currentOperation) + }) $currentMethod = $null } } @@ -198,209 +177,6 @@ function Get-OperationIdRegex { return [regex]::new($pattern) } -function Get-NormalizedOperationKey { - param([string]$Method, [string]$Path) - - $normalizedPath = [regex]::Replace($Path, '\{[^}]*\}', '{}').TrimEnd('/').ToLowerInvariant() - return "$($Method.ToUpperInvariant()) $normalizedPath" -} - -function Get-FinalOperationKey { - param([string]$Method, [string]$Path) - - $possiblePath = $Path.TrimEnd('/') -creplace '/microsoft\.graph\.([a-zA-Z_][a-zA-Z0-9_]*(?:\(.*\))?)$', '/$1' - return Get-NormalizedOperationKey $Method ($possiblePath -replace '\(\)$', '') -} - -function Test-FinalOperationTranslation { - param([object]$LegacyOperation, [object]$CompatibleOperation) - - $kind = $LegacyOperation.OperationType - if ($kind -cnotin @('action', 'function') -or $kind -cne $CompatibleOperation.OperationType) { - return 'both actual operations must declare the same action/function kind' - } - $requiredMethod = if ($kind -ceq 'action') { 'POST' } else { 'GET' } - if ($LegacyOperation.Method -cne $requiredMethod -or $CompatibleOperation.Method -cne $requiredMethod) { - return "$kind translation requires HTTP $requiredMethod on both operations" - } - $oldPath = $LegacyOperation.Path.TrimEnd('/') - $newPath = $CompatibleOperation.Path.TrimEnd('/') - $oldSplit = $oldPath.LastIndexOf('/') - $newSplit = $newPath.LastIndexOf('/') - if ((Get-NormalizedOperationKey $requiredMethod $oldPath.Substring(0, $oldSplit)) -cne - (Get-NormalizedOperationKey $requiredMethod $newPath.Substring(0, $newSplit))) { - return 'final-operation translation requires the same normalized parent' - } - $oldTerminal = [regex]::Replace($oldPath.Substring($oldSplit + 1), '\{[^}]*\}', '{}') - $newTerminal = [regex]::Replace($newPath.Substring($newSplit + 1), '\{[^}]*\}', '{}') - $qualified = [regex]::Match($oldTerminal, '^microsoft\.graph\.(?[a-zA-Z_][a-zA-Z0-9_]*(?:\(.*\))?)$') - if ($qualified.Success) { - $bare = $qualified.Groups['bare'].Value - if ($bare -ceq $newTerminal -or - ($kind -ceq 'function' -and ($bare -creplace '\(\)$', '') -ceq ($newTerminal -creplace '\(\)$', ''))) { - return - } - } - elseif ($kind -ceq 'function' -and - (($oldTerminal -ceq 'delta' -and $newTerminal -ceq 'delta()') -or - ($oldTerminal -ceq 'delta()' -and $newTerminal -ceq 'delta'))) { - return - } - return 'only exact final microsoft.graph. qualification removal or function delta/delta() equivalence is supported' -} - -function New-OperationLookup { - param([object[]]$Operations, [switch]$FinalOperation) - - $lookup = [System.Collections.Generic.Dictionary[string, System.Collections.Generic.List[object]]]::new([StringComparer]::Ordinal) - foreach ($operation in $Operations) { - $key = if ($FinalOperation) { Get-FinalOperationKey $operation.Method $operation.Path } - else { Get-NormalizedOperationKey $operation.Method $operation.Path } - if (-not $lookup.ContainsKey($key)) { - $lookup[$key] = [System.Collections.Generic.List[object]]::new() - } - $lookup[$key].Add($operation) - } - return ,$lookup -} - -function Test-LegacyOperationTranslation { - param( - [object]$Directive, - [object]$ProfileMap, - [string]$ModuleName, - [string]$Profile, - [object[]]$CompatibleOperations - ) - - if ($Directive.Classification -ne 'OperationIdSuppression') { - return "$Profile legacy translation is only supported for OperationIdSuppression" - } - if ([string]::IsNullOrWhiteSpace($ProfileMap.notes)) { - "$Profile legacy translation notes are required" - } - if ($ProfileMap.absenceExpected -cne $false) { - "$Profile legacy translation requires absenceExpected: false, not an API-absence claim" - } - $legacyPath = Join-Path (Join-Path $legacySpecRoot $Profile) "$ModuleName.yml" - $compatiblePath = Join-Path (Join-Path $specRoot $Profile) "$ModuleName.yml" - if (-not (Test-Path $legacyPath) -or -not (Test-Path $compatiblePath)) { - return "$Profile legacy translation requires both same-module/profile legacy and compatible specs" - } - try { - $regex = Get-OperationIdRegex $Directive.Text - } - catch [ArgumentException] { - return "$Profile legacy operation-ID regex cannot be validated: $($_.Exception.Message)" - } - $legacyOperations = @(Get-SpecOperations -ModuleName $ModuleName -Profile $Profile -Root $legacySpecRoot) - $sourceMatches = @($legacyOperations | Where-Object { $regex.IsMatch($_.OperationId) }) - if ($sourceMatches.Count -eq 0) { - return "$Profile original operation-ID regex matches no legacy operations; successors cannot be inferred" - } - $legacyLookup = New-OperationLookup $legacyOperations - $compatibleLookup = New-OperationLookup $CompatibleOperations - $finalOperationLookup = New-OperationLookup $CompatibleOperations -FinalOperation - $sourceKeys = [System.Collections.Generic.HashSet[string]]::new([StringComparer]::Ordinal) - foreach ($operation in $sourceMatches) { - [void]$sourceKeys.Add("$($operation.Method) $($operation.Path) [$($operation.OperationId)]") - } - $reviewedKeys = [System.Collections.Generic.HashSet[string]]::new([StringComparer]::Ordinal) - $removed = @() - if ($ProfileMap.PSObject.Properties['removedLegacyOperations']) { - if ($ProfileMap.removedLegacyOperations -isnot [array]) { - "$Profile removedLegacyOperations must be an explicit array" - } - else { $removed = $ProfileMap.removedLegacyOperations } - } - $evidence = @( - foreach ($operation in $ProfileMap.operations) { - [pscustomobject]@{ - Method = "$($operation.method)".ToUpperInvariant() - Path = "$($operation.legacyPath)" - OperationId = "$($operation.legacyOperationId)" - CompatiblePath = "$($operation.path)" - Translation = $operation.PSObject.Properties['legacyPathTranslation'] - Removed = $false - Notes = '' - } - } - foreach ($operation in $removed) { - [pscustomobject]@{ - Method = "$($operation.method)".ToUpperInvariant() - Path = "$($operation.path)" - OperationId = "$($operation.operationId)" - CompatiblePath = '' - Translation = $operation.PSObject.Properties['legacyPathTranslation'] - Removed = $true - Notes = "$($operation.notes)" - } - } - ) - foreach ($expected in $evidence) { - $key = "$($expected.Method) $($expected.Path) [$($expected.OperationId)]" - if (-not $reviewedKeys.Add($key)) { - "$Profile duplicate legacy evidence '$key'" - } - if (-not $sourceKeys.Contains($key)) { - "$Profile legacy evidence '$key' is not an exact original regex match" - } - $normalizedKey = Get-NormalizedOperationKey $expected.Method $expected.Path - $oldMatches = @() - if ($legacyLookup.ContainsKey($normalizedKey)) { $oldMatches = $legacyLookup[$normalizedKey].ToArray() } - if ($oldMatches.Count -ne 1) { - "$Profile legacy method/normalized path '$normalizedKey' matched $($oldMatches.Count) operations; bridge must be unique" - } - $usesFinalTranslation = $expected.Translation -and $expected.Translation.Value -ceq 'UnqualifyFinalOperation' - if ($expected.Translation -and (-not $usesFinalTranslation -or $expected.Removed)) { - "$Profile legacyPathTranslation must be 'UnqualifyFinalOperation' on a surviving operation" - } - $currentKey = if ($usesFinalTranslation) { Get-FinalOperationKey $expected.Method $expected.Path } else { $normalizedKey } - $lookup = if ($usesFinalTranslation) { $finalOperationLookup } else { $compatibleLookup } - $currentMatches = @() - if ($lookup.ContainsKey($currentKey)) { $currentMatches = $lookup[$currentKey].ToArray() } - if ($expected.Removed) { - if ([string]::IsNullOrWhiteSpace($expected.Notes)) { - "$Profile removed legacy operation '$key' requires review notes" - } - if ($currentMatches.Count -ne 0) { - "$Profile removed legacy operation '$key' still has $($currentMatches.Count) compatible method/normalized-path matches" - } - # Potential converter counterparts block removal even without the translation opt-in. - $possibleKey = Get-FinalOperationKey $expected.Method $expected.Path - $possibleSuccessors = @() - if ($finalOperationLookup.ContainsKey($possibleKey)) { $possibleSuccessors = $finalOperationLookup[$possibleKey].ToArray() } - if ($currentMatches.Count -eq 0 -and $possibleSuccessors.Count -gt 0) { - "$Profile cannot verify removal of '$key': a qualified/bare or empty-argument compatible counterpart needs reviewed path translation" - } - } - else { - if ([string]::IsNullOrWhiteSpace($expected.Path) -or [string]::IsNullOrWhiteSpace($expected.OperationId)) { - "$Profile legacyPath and legacyOperationId evidence are required" - } - if ($usesFinalTranslation) { - if ($currentMatches.Count -eq 1 -and $currentMatches[0].Path -cne $expected.CompatiblePath) { - "$Profile legacy path translation must select the exact unique compatible counterpart for '$key'" - } - if ($oldMatches.Count -eq 1 -and $currentMatches.Count -eq 1) { - foreach ($issue in @(Test-FinalOperationTranslation $oldMatches[0] $currentMatches[0])) { - "$Profile legacy path translation for '$key': $issue" - } - } - } - elseif ((Get-NormalizedOperationKey $expected.Method $expected.CompatiblePath) -cne $normalizedKey) { - "$Profile legacy and compatible method/normalized path must be identical for '$key'" - } - if ($currentMatches.Count -ne 1) { - "$Profile compatible method/normalized path '$normalizedKey' matched $($currentMatches.Count) operations; bridge must be unique" - } - } - } - if (-not $reviewedKeys.SetEquals($sourceKeys)) { - "$Profile legacy evidence must account for the complete original regex match set ($($sourceMatches.Count) operations)" - } -} - if (-not $Module -or $Module.Count -eq 0) { $Module = @(Get-ChildItem $srcRoot -Directory | Where-Object { Test-Path (Join-Path $_.FullName "$($_.Name).md") @@ -489,25 +265,10 @@ foreach ($moduleName in $Module) { $missing.Add("$profile operations must be an explicit array") continue } - $usesLegacyIds = $profileMap.operationIdSource -ceq 'Legacy' - if ($profileMap.PSObject.Properties['operationIdSource'] -and -not $usesLegacyIds) { - $missing.Add("$profile operationIdSource must be 'Legacy' when supplied") - } - if (-not $usesLegacyIds -and ( - $profileMap.PSObject.Properties['removedLegacyOperations'] -or - @($profileMap.operations | Where-Object { - $_.PSObject.Properties['legacyPath'] -or $_.PSObject.Properties['legacyOperationId'] -or - $_.PSObject.Properties['legacyPathTranslation'] - }).Count -gt 0)) { - $missing.Add("$profile legacy evidence requires explicit operationIdSource: Legacy") - } if ($profileMap.PSObject.Properties['excluded'] -and $profileMap.excluded -isnot [bool]) { $missing.Add("$profile excluded must be a boolean") } if ($profileMap.excluded -is [bool] -and $profileMap.excluded) { - if ($usesLegacyIds) { - $missing.Add("$profile cannot combine exclusion with legacy translation") - } $specPath = Join-Path (Join-Path $specRoot $profile) "$moduleName.yml" if (Test-Path $specPath) { $missing.Add("$profile cannot be excluded because its compatible spec exists") @@ -554,17 +315,10 @@ foreach ($moduleName in $Module) { $profileMatches[$profile] += $matches[0] } } - if (@($profileMap.operations).Count -eq 0 -and -not $profileMap.absenceExpected -and -not $usesLegacyIds) { + if (@($profileMap.operations).Count -eq 0 -and -not $profileMap.absenceExpected) { $missing.Add("$profile has no operations and is not marked absenceExpected") } - if ($usesLegacyIds) { - foreach ($issue in @(Test-LegacyOperationTranslation -Directive $directive -ProfileMap $profileMap ` - -ModuleName $moduleName -Profile $profile -CompatibleOperations $operationsByProfile[$profile])) { - $missing.Add($issue) - } - $notes = "$notes $profile reviewed legacy operation-ID translation: $($profileMap.notes)".Trim() - } - elseif ($directive.Classification -eq 'OperationIdSuppression') { + if ($directive.Classification -eq 'OperationIdSuppression') { try { $regex = Get-OperationIdRegex $directive.Text $candidates = @($operationsByProfile[$profile] | Where-Object { $regex.IsMatch($_.OperationId) }) diff --git a/tools/Test-WrapperDirectiveMigrationInventory.ps1 b/tools/Test-WrapperDirectiveMigrationInventory.ps1 index 8a1d4a36c21..ea564b012dc 100644 --- a/tools/Test-WrapperDirectiveMigrationInventory.ps1 +++ b/tools/Test-WrapperDirectiveMigrationInventory.ps1 @@ -5,7 +5,7 @@ Validates reviewed directive mappings and the completion gate using isolated fix .DESCRIPTION Copies the inventory tool and preserved Compliance pilot inputs into a temporary repository layout. Exact fixture specifications exercise valid and stale evidence independently of live -API pruning. Also checks read-only live deferred and empty-module inventory. +API pruning. Also checks read-only live candidate, deferred, and empty-module inventory. This is not a claim that every live module ledger passes; audit those modules separately. #> [CmdletBinding()] @@ -281,305 +281,6 @@ paths: throw 'Quoted YAML function keys must resolve exact unescaped method/path/operation-ID evidence.' } - Write-FixtureFile 'src\LegacyBridge\LegacyBridge.md' @' -directive: - - remove-path-by-operation: ^legacy_.*Widget$ -'@ - $legacySpec = @' -openapi: 3.0.4 -paths: - '/widgets/{old-id}': - get: - operationId: legacy_GetWidget - patch: - operationId: legacy_UpdateWidget - '/retired/{old-id}': - delete: - operationId: legacy_DeleteWidget - /unselected: - get: - operationId: unrelated_GetOther -'@ - $currentSpec = @' -openapi: 3.0.4 -paths: - '/widgets/{widget-id}': - get: - operationId: widgets.GetWidget - patch: - operationId: widgets.UpdateWidget - /unselected: - get: - operationId: widgets.GetOther - '/different/{widget-id}': - get: - operationId: widgets.GetDifferent -'@ - Write-FixtureFile 'openApiDocs\v1.0\LegacyBridge.yml' $legacySpec - Write-FixtureFile 'openApiDocs_KiotaCompat\v1.0\LegacyBridge.yml' $currentSpec - $legacyMapping = @' -{ - "mappings": [{ - "module": "LegacyBridge", - "directiveIndex": 1, - "classification": "OperationIdSuppression", - "sourceContains": "remove-path-by-operation: ^legacy_.*Widget$", - "implementation": "CmdletConfigurator", - "profiles": { - "v1.0": { - "operationIdSource": "Legacy", - "notes": "Reviewed exact old/new IDs and method/path bridges; one old operation was pruned.", - "absenceExpected": false, - "operations": [ - { "method": "GET", "path": "/widgets/{widget-id}", "operationId": "widgets.GetWidget", "legacyPath": "/widgets/{old-id}", "legacyOperationId": "legacy_GetWidget" }, - { "method": "PATCH", "path": "/widgets/{widget-id}", "operationId": "widgets.UpdateWidget", "legacyPath": "/widgets/{old-id}", "legacyOperationId": "legacy_UpdateWidget" } - ], - "removedLegacyOperations": [ - { "method": "DELETE", "path": "/retired/{old-id}", "operationId": "legacy_DeleteWidget", "notes": "Actual old route has no compatible method/normalized-path counterpart." } - ] - }, - "beta": { - "excluded": true, - "operations": [], - "notes": "No compatible beta spec; not an API-absence claim." - } - } - }] -} -'@ - Set-Content $testMapping $legacyMapping - $bridged = @(& $fixtureTool -Module LegacyBridge -MappingPath $testMapping -FailOnUnresolved) - if ($bridged[0].Status -ne 'Mapped' -or $bridged[0].V1Operations.Count -ne 2 -or - $bridged[0].BetaOperations.Count -ne 0 -or - $bridged[0].Notes -notmatch 'reviewed legacy operation-ID translation') { - throw 'Reviewed complete legacy-ID bridges must map surviving compatible operations and retain exclusion notes.' - } - $literal = @(& $fixtureTool -Module LegacyBridge) - if ($literal[0].Status -ne 'Unresolved') { - throw 'Legacy specs must never cause automatic compatible regex resolution or inferred successors.' - } - $alignedSpec = $currentSpec.Replace('widgets.GetWidget', 'legacy_GetWidget'). - Replace('widgets.UpdateWidget', 'legacy_UpdateWidget') - Write-FixtureFile 'openApiDocs_KiotaCompat\v1.0\LegacyBridge.yml' $alignedSpec - $alignedMapping = $legacyMapping | ConvertFrom-Json - foreach ($operation in $alignedMapping.mappings[0].profiles.'v1.0'.operations) { - $operation.operationId = $operation.legacyOperationId - } - $alignedMapping | ConvertTo-Json -Depth 10 | Set-Content $testMapping - $aligned = @(& $fixtureTool -Module LegacyBridge -MappingPath $testMapping -FailOnUnresolved) - if ($aligned[0].Status -ne 'Mapped' -or $aligned[0].V1Operations.Count -ne 2) { - throw 'Reviewed Legacy source coverage must remain valid when compatible operation IDs are aligned.' - } - $alignedMapping.mappings[0].profiles.'v1.0'.PSObject.Properties.Remove('operationIdSource') - $alignedMapping.mappings[0].profiles.'v1.0'.PSObject.Properties.Remove('removedLegacyOperations') - foreach ($operation in $alignedMapping.mappings[0].profiles.'v1.0'.operations) { - $operation.PSObject.Properties.Remove('legacyPath') - $operation.PSObject.Properties.Remove('legacyOperationId') - } - $alignedMapping | ConvertTo-Json -Depth 10 | Set-Content $testMapping - $literalReviewed = @(& $fixtureTool -Module LegacyBridge -MappingPath $testMapping -FailOnUnresolved) - if ($literalReviewed[0].Status -ne 'Mapped' -or $literalReviewed[0].V1Operations.Count -ne 2) { - throw 'Aligned literal selectors must not require Legacy translation for their complete current match set.' - } - $alignedCandidate = @(& $fixtureTool -Module LegacyBridge) - if ($alignedCandidate[0].Status -ne 'Resolved' -or $alignedCandidate[0].Implementation -ne 'Candidate') { - throw 'Aligned operation IDs alone must not count as reviewed completion.' - } - Assert-Failure { & $fixtureTool -Module LegacyBridge -FailOnUnresolved } 'lack reviewed mappings' - Write-FixtureFile 'openApiDocs_KiotaCompat\v1.0\LegacyBridge.yml' $currentSpec - $bridgeCases = @( - @{ Mutate = { param($d) $d.mappings[0].profiles.'v1.0'.PSObject.Properties.Remove('operationIdSource') }; Pattern = 'requires explicit operationIdSource' } - @{ Mutate = { param($d) $d.mappings[0].profiles.'v1.0'.operationIdSource = 'legacy' }; Pattern = "operationIdSource must be 'Legacy'" } - @{ Mutate = { param($d) $d.mappings[0].profiles.'v1.0'.notes = '' }; Pattern = 'legacy translation notes are required' } - @{ Mutate = { param($d) $d.mappings[0].profiles.'v1.0'.absenceExpected = $true }; Pattern = 'requires absenceExpected: false' } - @{ Mutate = { param($d) $d.mappings[0].classification = 'SubjectRename' }; Pattern = 'classification changed|only supported for OperationIdSuppression' } - @{ Mutate = { param($d) $d.mappings[0].profiles.'v1.0'.operations = @($d.mappings[0].profiles.'v1.0'.operations[0]) }; Pattern = 'complete original regex match set' } - @{ Mutate = { param($d) $d.mappings[0].profiles.'v1.0'.PSObject.Properties.Remove('removedLegacyOperations') }; Pattern = 'complete original regex match set' } - @{ Mutate = { param($d) $d.mappings[0].profiles.'v1.0'.operations[0].legacyOperationId = 'legacy_getWidget' }; Pattern = 'not an exact original regex match' } - @{ Mutate = { param($d) $d.mappings[0].profiles.'v1.0'.operations[0].legacyPath = '/Widgets/{old-id}' }; Pattern = 'not an exact original regex match' } - @{ Mutate = { param($d) $d.mappings[0].profiles.'v1.0'.operations[0].PSObject.Properties.Remove('legacyOperationId') }; Pattern = 'legacyPath and legacyOperationId evidence are required' } - @{ Mutate = { param($d) $d.mappings[0].profiles.'v1.0'.operations[0].PSObject.Properties.Remove('legacyPath') }; Pattern = 'legacyPath and legacyOperationId evidence are required' } - @{ Mutate = { param($d) $d.mappings[0].profiles.'v1.0'.operations[0].method = 'POST' }; Pattern = 'matched 0 operations' } - @{ Mutate = { param($d) $d.mappings[0].profiles.'v1.0'.operations[0].path = '/different/{widget-id}'; $d.mappings[0].profiles.'v1.0'.operations[0].operationId = 'widgets.GetDifferent' }; Pattern = 'method/normalized path must be identical' } - @{ Mutate = { param($d) $d.mappings[0].profiles.'v1.0'.operations[0].legacyPath = '/unselected'; $d.mappings[0].profiles.'v1.0'.operations[0].legacyOperationId = 'unrelated_GetOther' }; Pattern = 'not an exact original regex match' } - @{ Mutate = { param($d) $d.mappings[0].profiles.'v1.0'.operations[0].operationId = 'stale.GetWidget' }; Pattern = 'operationId changed' } - @{ Mutate = { param($d) $d.mappings[0].profiles.'v1.0'.operations += $d.mappings[0].profiles.'v1.0'.operations[0] }; Pattern = 'duplicate legacy evidence' } - @{ Mutate = { param($d) $d.mappings[0].profiles.'v1.0'.removedLegacyOperations[0].notes = '' }; Pattern = 'requires review notes' } - @{ Mutate = { param($d) $d.mappings[0].profiles.'v1.0'.removedLegacyOperations[0].operationId = 'unrelated_GetOther' }; Pattern = 'not an exact original regex match' } - @{ Mutate = { param($d) $d.mappings[0].profiles.'v1.0'.removedLegacyOperations = $null }; Pattern = 'removedLegacyOperations must be an explicit array' } - @{ Mutate = { param($d) $d.mappings[0].profiles.'v1.0'.removedLegacyOperations += [pscustomobject]@{method='GET';path='/widgets/{old-id}';operationId='legacy_GetWidget';notes='False removal claim'} }; Pattern = 'still has 1 compatible' } - @{ Mutate = { param($d) $d.mappings[0].profiles.beta | Add-Member operationIdSource 'Legacy' }; Pattern = 'cannot combine exclusion with legacy translation' } - ) - foreach ($case in $bridgeCases) { - $document = $legacyMapping | ConvertFrom-Json - & $case.Mutate $document - $document | ConvertTo-Json -Depth 10 | Set-Content $testMapping - Assert-Failure { & $fixtureTool -Module LegacyBridge -MappingPath $testMapping } $case.Pattern - } - Set-Content $testMapping $legacyMapping - Write-FixtureFile 'openApiDocs\v1.0\LegacyBridge.yml' ($legacySpec -replace 'legacy_', 'changed_') - Assert-Failure { & $fixtureTool -Module LegacyBridge -MappingPath $testMapping } 'matches no legacy operations' - Write-FixtureFile 'openApiDocs\v1.0\LegacyBridge.yml' ($legacySpec + @' - - '/widgets/{ambiguous-id}': - get: - operationId: unrelated_Ambiguous -'@) - Assert-Failure { & $fixtureTool -Module LegacyBridge -MappingPath $testMapping } 'legacy method/normalized path .* matched 2 operations' - Write-FixtureFile 'openApiDocs\v1.0\LegacyBridge.yml' $legacySpec - Write-FixtureFile 'openApiDocs_KiotaCompat\v1.0\LegacyBridge.yml' ($currentSpec + @' - - '/widgets/{ambiguous-id}': - get: - operationId: widgets.Ambiguous -'@) - Assert-Failure { & $fixtureTool -Module LegacyBridge -MappingPath $testMapping } 'compatible method/normalized path .* matched 2 operations' - Write-FixtureFile 'openApiDocs_KiotaCompat\v1.0\LegacyBridge.yml' $currentSpec - Remove-Item (Join-Path $fixtureRoot 'openApiDocs\v1.0\LegacyBridge.yml') - Assert-Failure { & $fixtureTool -Module LegacyBridge -MappingPath $testMapping } 'requires both same-module/profile' - Write-FixtureFile 'openApiDocs\v1.0\LegacyBridge.yml' $legacySpec - Remove-Item (Join-Path $fixtureRoot 'openApiDocs_KiotaCompat\v1.0\LegacyBridge.yml') - Assert-Failure { & $fixtureTool -Module LegacyBridge -MappingPath $testMapping } 'requires both same-module/profile' - Write-FixtureFile 'openApiDocs_KiotaCompat\v1.0\LegacyBridge.yml' "openapi: 3.0.4`npaths: {}" - $document = $legacyMapping | ConvertFrom-Json - foreach ($operation in $document.mappings[0].profiles.'v1.0'.operations) { - $document.mappings[0].profiles.'v1.0'.removedLegacyOperations += [pscustomobject]@{ - method = $operation.method - path = $operation.legacyPath - operationId = $operation.legacyOperationId - notes = 'Reviewed old operation has no current compatible method/path.' - } - } - $document.mappings[0].profiles.'v1.0'.operations = @() - $document | ConvertTo-Json -Depth 10 | Set-Content $testMapping - $removedOnly = @(& $fixtureTool -Module LegacyBridge -MappingPath $testMapping -FailOnUnresolved) - if ($removedOnly[0].Status -ne 'Mapped' -or $removedOnly[0].V1Operations.Count -ne 0) { - throw 'An entirely pruned, fully evidenced legacy match set needs no invented compatible operations.' - } - foreach ($case in @( - @{ OldPath = '/widgets/{old-id}/microsoft.graph.refresh'; NewPath = '/widgets/{widget-id}/refresh'; Method = 'POST' } - @{ OldPath = '/widgets/{old-id}/delta'; NewPath = '/widgets/{widget-id}/delta()'; Method = 'GET' } - @{ OldPath = '/widgets/{old-id}/delta'; NewPath = '/widgets/{widget-id}/delta()/'; Method = 'GET' } - @{ OldPath = '/widgets/{old-id}/delta()/'; NewPath = '/widgets/{widget-id}/delta/'; Method = 'GET' } - @{ OldPath = '/widgets/{old-id}/microsoft.graph.delta()//'; NewPath = '/widgets/{widget-id}/delta//'; Method = 'GET' } - )) { - Write-FixtureFile 'openApiDocs\v1.0\LegacyBridge.yml' ($legacySpec + "`n '$($case.OldPath)':`n $($case.Method.ToLowerInvariant()):`n operationId: legacy_ConvertedWidget") - Write-FixtureFile 'openApiDocs_KiotaCompat\v1.0\LegacyBridge.yml' ($currentSpec + "`n '$($case.NewPath)':`n $($case.Method.ToLowerInvariant()):`n operationId: widgets.Converted") - $document = $legacyMapping | ConvertFrom-Json - $document.mappings[0].profiles.'v1.0'.removedLegacyOperations += [pscustomobject]@{ - method = $case.Method - path = $case.OldPath - operationId = 'legacy_ConvertedWidget' - notes = 'False removal claim must not hide a known converter path change.' - } - $document | ConvertTo-Json -Depth 10 | Set-Content $testMapping - Assert-Failure { & $fixtureTool -Module LegacyBridge -MappingPath $testMapping } 'cannot verify removal.*reviewed path translation' - } - - $finalCases = @( - @{ Old = '/widgets/{old-id}/microsoft.graph.refresh'; New = '/widgets/{widget-id}/refresh'; Method = 'POST'; OldKind = 'action'; NewKind = 'action' } - @{ Old = '/widgets/{old-id}/microsoft.graph.delta'; New = '/widgets/{widget-id}/delta()'; Method = 'GET'; OldKind = 'function'; NewKind = 'function' } - @{ Old = '/widgets/{old-id}/microsoft.graph.delta()'; New = '/widgets/{widget-id}/delta'; Method = 'GET'; OldKind = 'function'; NewKind = 'function' } - @{ Old = '/widgets/{old-id}/delta'; New = '/widgets/{widget-id}/delta()'; Method = 'GET'; OldKind = 'function'; NewKind = 'function' } - @{ Old = '/widgets/{old-id}/delta()'; New = '/widgets/{widget-id}/delta'; Method = 'GET'; OldKind = 'function'; NewKind = 'function' } - @{ Old = '/widgets/{old-id}/delta'; New = '/widgets/{widget-id}/delta()/'; Method = 'GET'; OldKind = 'function'; NewKind = 'function' } - @{ Old = '/widgets/{old-id}/delta()/'; New = '/widgets/{widget-id}/delta/'; Method = 'GET'; OldKind = 'function'; NewKind = 'function' } - @{ Old = '/widgets/{old-id}/microsoft.graph.delta()//'; New = '/widgets/{widget-id}/delta//'; Method = 'GET'; OldKind = 'function'; NewKind = 'function' } - @{ Old = '/widgets/{old-id}/microsoft.graph.refresh//'; New = '/widgets/{widget-id}/refresh/'; Method = 'POST'; OldKind = 'action'; NewKind = 'action' } - @{ Old = "/widgets/{old-id}/microsoft.graph.resolve(Input='{old-input}')"; New = "/widgets/{widget-id}/resolve(Input='{input}')"; Method = 'GET'; OldKind = 'function'; NewKind = 'function' } - @{ Old = '/widgets/{old-id}/microsoft.graph.refresh'; New = '/widgets/{widget-id}/refresh'; Method = 'POST'; OldKind = ''; NewKind = 'action'; Error = 'both actual operations must declare the same action/function kind' } - @{ Old = '/widgets/{old-id}/microsoft.graph.refresh'; New = '/widgets/{widget-id}/refresh'; Method = 'POST'; OldKind = 'action'; NewKind = ''; Error = 'both actual operations must declare the same action/function kind' } - @{ Old = '/widgets/{old-id}/microsoft.graph.refresh'; New = '/widgets/{widget-id}/refresh'; Method = 'POST'; OldKind = 'action'; NewKind = 'function'; Error = 'both actual operations must declare the same action/function kind' } - @{ Old = '/widgets/{old-id}/microsoft.graph.user'; New = '/widgets/{widget-id}/user'; Method = 'GET'; OldKind = 'operation'; NewKind = 'operation'; Error = 'both actual operations must declare the same action/function kind' } - @{ Old = '/widgets/{old-id}/microsoft.graph.refresh'; New = '/widgets/{widget-id}/refresh'; Method = 'GET'; OldKind = 'action'; NewKind = 'action'; Error = 'action translation requires HTTP POST' } - @{ Old = '/widgets/{old-id}/microsoft.graph.delta'; New = '/widgets/{widget-id}/delta()'; Method = 'POST'; OldKind = 'function'; NewKind = 'function'; Error = 'function translation requires HTTP GET' } - @{ Old = '/widgets/{old-id}/microsoft.graph.refresh'; New = '/other/{widget-id}/refresh'; Method = 'POST'; OldKind = 'action'; NewKind = 'action'; Error = 'matched 0 operations|exact unique compatible counterpart' } - @{ Old = '/widgets/{old-id}/microsoft.graph.refresh'; New = '/widgets/{widget-id}/renamed'; Method = 'POST'; OldKind = 'action'; NewKind = 'action'; Error = 'matched 0 operations' } - @{ Old = '/widgets/{old-id}/microsoft.graph.refresh'; New = '/widgets/{widget-id}/refresh()'; Method = 'POST'; OldKind = 'action'; NewKind = 'action'; Error = 'only exact final' } - @{ Old = '/widgets/{old-id}/resolve'; New = '/widgets/{widget-id}/resolve()'; Method = 'GET'; OldKind = 'function'; NewKind = 'function'; Error = 'only exact final' } - @{ Old = "/widgets/{old-id}/microsoft.graph.delta(token='{token}')"; New = '/widgets/{widget-id}/delta()'; Method = 'GET'; OldKind = 'function'; NewKind = 'function'; Error = 'matched 0 operations' } - @{ Old = '/widgets/{old-id}/microsoft.graph.group/refresh'; New = '/widgets/{widget-id}/group/refresh'; Method = 'POST'; OldKind = 'action'; NewKind = 'action'; Error = 'matched 0 operations' } - ) - foreach ($case in $finalCases) { - $oldMetadata = if ($case.OldKind) { "`n x-ms-docs-operation-type: $($case.OldKind)" } else { '' } - $newMetadata = if ($case.NewKind) { "`n x-ms-docs-operation-type: $($case.NewKind)" } else { '' } - # Cover operation metadata both before and after operationId. - Write-FixtureFile 'openApiDocs\v1.0\LegacyBridge.yml' ("openapi: 3.0.4`npaths:`n `"$($case.Old)`":`n $($case.Method.ToLowerInvariant()):$oldMetadata`n operationId: legacy_ConvertedWidget") - Write-FixtureFile 'openApiDocs_KiotaCompat\v1.0\LegacyBridge.yml' ("openapi: 3.0.4`npaths:`n `"$($case.New)`":`n $($case.Method.ToLowerInvariant()):`n operationId: widgets.Converted$newMetadata") - $document = $legacyMapping | ConvertFrom-Json - $document.mappings[0].profiles.'v1.0'.removedLegacyOperations = @() - $document.mappings[0].profiles.'v1.0'.operations = @([pscustomobject]@{ - method = $case.Method - path = $case.New - operationId = 'widgets.Converted' - legacyPath = $case.Old - legacyOperationId = 'legacy_ConvertedWidget' - legacyPathTranslation = 'UnqualifyFinalOperation' - }) - $document | ConvertTo-Json -Depth 10 | Set-Content $testMapping - if ($case.Error) { - Assert-Failure { & $fixtureTool -Module LegacyBridge -MappingPath $testMapping } $case.Error - } - else { - $translated = @(& $fixtureTool -Module LegacyBridge -MappingPath $testMapping -FailOnUnresolved) - if ($translated[0].Status -ne 'Mapped' -or $translated[0].V1Operations.Count -ne 1) { - throw 'Explicit kind-guarded final-operation translation must preserve the exact current operation.' - } - $document.mappings[0].profiles.'v1.0'.operations[0].PSObject.Properties.Remove('legacyPathTranslation') - $document | ConvertTo-Json -Depth 10 | Set-Content $testMapping - Assert-Failure { & $fixtureTool -Module LegacyBridge -MappingPath $testMapping } 'method/normalized path must be identical' - } - } - # A target may not substitute a different valid operation for the unique converted route. - Write-FixtureFile 'openApiDocs\v1.0\LegacyBridge.yml' @' -openapi: 3.0.4 -paths: - '/widgets/{old-id}/microsoft.graph.refresh': - post: - operationId: legacy_ConvertedWidget - x-ms-docs-operation-type: action -'@ - $finalCurrentSpec = @' -openapi: 3.0.4 -paths: - '/widgets/{widget-id}/refresh': - post: - operationId: widgets.Converted - x-ms-docs-operation-type: action - '/other/{widget-id}/refresh': - post: - operationId: other.Refresh - x-ms-docs-operation-type: action -'@ - Write-FixtureFile 'openApiDocs_KiotaCompat\v1.0\LegacyBridge.yml' $finalCurrentSpec - $document = $legacyMapping | ConvertFrom-Json - $document.mappings[0].profiles.'v1.0'.removedLegacyOperations = @() - $document.mappings[0].profiles.'v1.0'.operations = @([pscustomobject]@{ - method = 'POST' - path = '/other/{widget-id}/refresh' - operationId = 'other.Refresh' - legacyPath = '/widgets/{old-id}/microsoft.graph.refresh' - legacyOperationId = 'legacy_ConvertedWidget' - legacyPathTranslation = 'UnqualifyFinalOperation' - }) - $document | ConvertTo-Json -Depth 10 | Set-Content $testMapping - Assert-Failure { & $fixtureTool -Module LegacyBridge -MappingPath $testMapping } 'exact unique compatible counterpart' - $document.mappings[0].profiles.'v1.0'.operations[0].path = '/widgets/{widget-id}/refresh' - $document.mappings[0].profiles.'v1.0'.operations[0].operationId = 'widgets.Converted' - $document | ConvertTo-Json -Depth 10 | Set-Content $testMapping - Write-FixtureFile 'openApiDocs_KiotaCompat\v1.0\LegacyBridge.yml' ($finalCurrentSpec + @' - - '/widgets/{ambiguous-id}/refresh': - post: - operationId: widgets.AmbiguousRefresh - x-ms-docs-operation-type: action -'@) - Assert-Failure { & $fixtureTool -Module LegacyBridge -MappingPath $testMapping } 'matched 2 operations' - Write-FixtureFile 'openApiDocs_KiotaCompat\v1.0\LegacyBridge.yml' $finalCurrentSpec - $document.mappings[0].profiles.'v1.0'.operations[0].legacyPathTranslation = 'GenericAlias' - $document | ConvertTo-Json -Depth 10 | Set-Content $testMapping - Assert-Failure { & $fixtureTool -Module LegacyBridge -MappingPath $testMapping } "legacyPathTranslation must be 'UnqualifyFinalOperation'" - Write-FixtureFile 'src\Deferred\Deferred.md' @' ``` yaml directive: @@ -615,23 +316,16 @@ directive: $document | ConvertTo-Json -Depth 10 | Set-Content $testMapping Assert-Failure { & $fixtureTool -Module Audit -MappingPath $testMapping -FailOnUnresolved } 'entries do not match a directive' - Write-FixtureFile 'src\Applications\Applications.md' @' -directive: - - where: - verb: Get - subject: UnreviewedFixture - remove: true - - where: - parameter-name: Id - set: - alias: FixtureId -'@ - $applications = @((& $fixtureTool -Module Applications -AsJson | Out-String) | ConvertFrom-Json) + $applications = @((& $tool -Module Applications -AsJson | Out-String) | ConvertFrom-Json) if (@($applications | Where-Object Status -eq 'Deferred').Count -lt 1 -or @($applications | Where-Object Status -eq 'Unresolved').Count -lt 1) { - throw 'An unreviewed fixture must expose deferred and unresolved shared directives.' + throw 'Live Applications must retain deferred and unresolved shared directives.' + } + $calendar = @(& $tool -Module Calendar) + if (@($calendar | Where-Object { $_.Status -eq 'Resolved' -and $_.Implementation -eq 'Candidate' }).Count -lt 1) { + throw 'Live Calendar operation-ID matches must remain candidates without reviewed evidence.' } - Assert-Failure { & $fixtureTool -Module Applications -FailOnUnresolved } 'lack reviewed mappings' + Assert-Failure { & $tool -Module Calendar -FailOnUnresolved } 'lack reviewed mappings' $schemaDirective = @(& $tool -Module Identity.SignIns) | Where-Object Classification -eq 'DeferredSchema' if (@($schemaDirective).Count -ne 1 -or $schemaDirective.Status -ne 'Deferred') { throw 'Live schema/response directives must remain deferred.' diff --git a/tools/WrapperGenerator/README.md b/tools/WrapperGenerator/README.md index 55cd93be025..5aef7442589 100644 --- a/tools/WrapperGenerator/README.md +++ b/tools/WrapperGenerator/README.md @@ -425,10 +425,9 @@ For each reviewed directive: `profiles`, each with an explicit `operations` array and boolean `absenceExpected` unless explicitly excluded for a missing compatible specification as described below. Every operation needs exact `method`, case-sensitive `path`, and case-sensitive `operationId` - evidence from that profile. A present profile with no selected operations requires - `operations: []` and `absenceExpected: true`; it cannot also declare operations. - Operation-ID suppressions must cover exactly the regex's matched operation set in each - profile, not a reviewed subset. + evidence from that profile. An absent profile requires `operations: []` and + `absenceExpected: true`; it cannot also declare operations. Operation-ID suppressions must + cover exactly the regex's matched operation set in each profile, not a reviewed subset. Both profiles may declare reviewed absence when neither has matching operations. 2. Add only configuration the wrapper naming rules cannot already produce. Pin structural naming behavior in `NamingTests` instead of adding redundant overrides. @@ -456,86 +455,6 @@ the shared-directive-only scope. A spec added later invalidates the exclusion un Quoted YAML function keys are decoded before exact path comparison, so doubled single quotes in a key such as `User=''{User}''` become the literal `User='{User}'` in ledger evidence. -### Reviewed legacy source coverage after operation-ID alignment - -Literal operation-ID matching against compatible specifications remains the default. -Compatible downloads now project the singularized PowerShell operation IDs while retaining -the Plain schemas (`tools/Utilities/Set-OpenApiOperationIds.ps1`). An older dotted compatible -ID is no longer valid ledger evidence merely because it was correct before alignment. -Use current exact method/path/ID evidence; ordinary aligned selectors need no Legacy opt-in. - -Alignment does not guarantee that the original shared regex selects every surviving route. -For example, the beta Enrollment selector matches eight compatible IDs but eleven actual -legacy operations; Planner beta matches 182 compatible IDs but 206 legacy operations. -The remaining three and 24 routes have reviewed final-operation path conversions and -different operation-ID ancestry. Explicit complete-source validation is still required -for those cases. Opt into the same module/profile's actual `openApiDocs` source set, -not an inferred alias, a rewritten regex, or a union with literal compatible matches: - -```json -"beta": { - "operationIdSource": "Legacy", - "notes": "Reviewed the complete original legacy regex match set against compatible routes.", - "absenceExpected": false, - "operations": [ - { - "method": "GET", - "path": "/planner/buckets/{plannerBucket-id}/tasks/delta()", - "operationId": "planner.bucket.plannerBucket.task_delta", - "legacyPath": "/planner/buckets/{plannerBucket-id}/tasks/microsoft.graph.delta()", - "legacyOperationId": "planner.bucket.task_delta", - "legacyPathTranslation": "UnqualifyFinalOperation" - } - ], - "removedLegacyOperations": [] -} -``` - -This is one real beta Planner bridge, not its complete suppression ledger; all selected -source operations must be included before the completion gate can pass. - -This disposition is supported only for `OperationIdSuppression`. Both actual -`openApiDocs//.yml` and compatible specifications must exist. The original -shared regex must match at least one legacy operation, and the ledger must account for its -**entire** match set. Each surviving operation needs exact old path/ID and current method/path/ID -evidence. The bridge must be unique by method and normalized path in both specifications; -normalization erases `{parameter}` names, lowercases the path, and trims trailing slashes. -Exact evidence remains case-sensitive. No changed methods, different route shapes, subject -variants, guessed successors, or operations absent from the legacy regex set are inferred. - -If an actual matched legacy operation has been pruned, record its old `method`, `path`, -`operationId`, and review `notes` in `removedLegacyOperations`. This is accepted only when -there are zero current compatible method/normalized-path matches. Surviving and removed -evidence together must cover the complete source set without duplicates. A wholly pruned -source set can have `operations: []` with all entries explicitly reviewed as removed; -`absenceExpected` must still be `false`, not a substitute API-absence assertion. -Translation cannot be combined with profile exclusion. If the original regex matches nothing -in the legacy specification, do not use `Legacy` or infer successor operations. An independently -reviewed **default literal no-match audit** can still be `Mapped` with `operations: []`, -`absenceExpected: true`, and no Legacy fields. Notes and module tests must distinguish selector -absence from API-operation absence. Without that review, the directive remains `Unresolved`. -Supplying legacy evidence without the explicit disposition fails. -For a reviewed final-operation converter change, add -`"legacyPathTranslation": "UnqualifyFinalOperation"` to that **surviving operation** record. -The exact old and new paths/IDs remain mandatory. This opt-in permits only: - -- Final `microsoft.graph.` to bare ``, under the same normalized parent. - Function spelling may additionally differ by an empty `()` suffix; nonempty arguments must - remain identical apart from placeholder names. -- Bare `delta` to `delta()` or the reverse, only for an actual function. - -Both specifications must explicitly declare the same `x-ms-docs-operation-type` (`action` or -`function`), with POST for actions and GET for functions. The compatible counterpart must be -unique, and every original legacy regex match still needs complete accounting. No resource -or cast conversion, earlier path-segment rewrite, generic alias, changed argument shape, or -variant expansion is accepted. Unknown translation names fail rather than being ignored. -Potential qualified/bare or empty-argument counterparts reject a removal claim even without -the opt-in, so a surviving operation cannot be silently reclassified as removed. -Trailing slashes on both paths are trimmed before terminal qualification or empty-argument -comparison; the exact recorded paths and IDs are still validated against their specifications. - -### Completion and audit - Use the existing switch as a **reviewed completion gate** after reconciling a module's ledger: ```powershell From ca87cf0e2e22d58627c91cf58cbcf16c8b4b95c5 Mon Sep 17 00:00:00 2001 From: Ramses Sanchez Hernandez Date: Mon, 2 Nov 2026 12:49:09 -0800 Subject: [PATCH 8/8] Align operation IDs for required shared directive paths Apply 67 finite exact module/profile/method/path corrections during the existing compatible-ID projection and refresh only those checked-in ID values. Preserve ordinary literal inventory, routes, operation kinds, typed schemas and unrelated IDs. Document the independent Governance overmatch instead of expanding directive coverage. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .../beta/DeviceManagement.Enrollment.yml | 6 +- .../beta/DeviceManagement.yml | 2 +- .../beta/Identity.Governance.yml | 40 +- openApiDocs_KiotaCompat/beta/Notes.yml | 18 +- openApiDocs_KiotaCompat/beta/Planner.yml | 48 +- openApiDocs_KiotaCompat/beta/Security.yml | 2 +- openApiDocs_KiotaCompat/v1.0/Notes.yml | 18 +- tools/README.md | 14 + tools/Tests/KiotaCompatOperationIds.Tests.ps1 | 134 +++++ tools/Utilities/RequiredPathOperationIds.json | 471 ++++++++++++++++++ tools/Utilities/Set-OpenApiOperationIds.ps1 | 14 + 11 files changed, 700 insertions(+), 67 deletions(-) create mode 100644 tools/Utilities/RequiredPathOperationIds.json diff --git a/openApiDocs_KiotaCompat/beta/DeviceManagement.Enrollment.yml b/openApiDocs_KiotaCompat/beta/DeviceManagement.Enrollment.yml index 7ca6c5e3f4d..7a9b70f01db 100644 --- a/openApiDocs_KiotaCompat/beta/DeviceManagement.Enrollment.yml +++ b/openApiDocs_KiotaCompat/beta/DeviceManagement.Enrollment.yml @@ -6634,7 +6634,7 @@ paths: externalDocs: description: Find more info here url: https://learn.microsoft.com/graph/api/unifiedroledefinition-assignedprincipals?view=graph-rest-beta - operationId: roleManagement.cloudPC.roleDefinition.unifiedRoleDefinition.inheritsPermissionsFrom.unifiedRoleDefinition_assignedPrincipal + operationId: roleManagement.cloudPC.roleDefinition.inheritsPermissionsFrom_assignedPrincipal parameters: - $ref: '#/components/parameters/top' - $ref: '#/components/parameters/skip' @@ -8408,7 +8408,7 @@ paths: externalDocs: description: Find more info here url: https://learn.microsoft.com/graph/api/unifiedroledefinition-assignedprincipals?view=graph-rest-beta - operationId: roleManagement.deviceManagement.roleDefinition.unifiedRoleDefinition.inheritsPermissionsFrom.unifiedRoleDefinition_assignedPrincipal + operationId: roleManagement.deviceManagement.roleDefinition.inheritsPermissionsFrom_assignedPrincipal parameters: - $ref: '#/components/parameters/top' - $ref: '#/components/parameters/skip' @@ -10149,7 +10149,7 @@ paths: externalDocs: description: Find more info here url: https://learn.microsoft.com/graph/api/unifiedroledefinition-assignedprincipals?view=graph-rest-beta - operationId: roleManagement.exchange.roleDefinition.unifiedRoleDefinition.inheritsPermissionsFrom.unifiedRoleDefinition_assignedPrincipal + operationId: roleManagement.exchange.roleDefinition.inheritsPermissionsFrom_assignedPrincipal parameters: - $ref: '#/components/parameters/top' - $ref: '#/components/parameters/skip' diff --git a/openApiDocs_KiotaCompat/beta/DeviceManagement.yml b/openApiDocs_KiotaCompat/beta/DeviceManagement.yml index 01c03d34c86..c3eeaadeedc 100644 --- a/openApiDocs_KiotaCompat/beta/DeviceManagement.yml +++ b/openApiDocs_KiotaCompat/beta/DeviceManagement.yml @@ -19701,7 +19701,7 @@ paths: tags: - deviceManagement.deviceManagementIntent summary: Invoke action updateSettings - operationId: deviceManagement.intent.deviceManagementIntent_updateSetting + operationId: deviceManagement.intent_updateSetting requestBody: description: Action parameters content: diff --git a/openApiDocs_KiotaCompat/beta/Identity.Governance.yml b/openApiDocs_KiotaCompat/beta/Identity.Governance.yml index c39c1ce8ae0..625e577e80c 100644 --- a/openApiDocs_KiotaCompat/beta/Identity.Governance.yml +++ b/openApiDocs_KiotaCompat/beta/Identity.Governance.yml @@ -6447,7 +6447,7 @@ paths: externalDocs: description: Find more info here url: https://learn.microsoft.com/graph/api/accessreviewinstance-acceptrecommendations?view=graph-rest-beta - operationId: identityGovernance.accessReview.definition.accessReviewScheduleDefinition.instance.accessReviewInstance.decision.accessReviewInstanceDecisionItem.instance_acceptRecommendation + operationId: identityGovernance.accessReview.definition.instance.decision.instance_acceptRecommendation responses: '204': description: Success @@ -6465,7 +6465,7 @@ paths: externalDocs: description: Find more info here url: https://learn.microsoft.com/graph/api/accessreviewinstance-applydecisions?view=graph-rest-beta - operationId: identityGovernance.accessReview.definition.accessReviewScheduleDefinition.instance.accessReviewInstance.decision.accessReviewInstanceDecisionItem.instance_applyDecision + operationId: identityGovernance.accessReview.definition.instance.decision.instance_applyDecision responses: '204': description: Success @@ -6516,7 +6516,7 @@ paths: externalDocs: description: Find more info here url: https://learn.microsoft.com/graph/api/accessreviewinstance-batchrecorddecisions?view=graph-rest-beta - operationId: identityGovernance.accessReview.definition.accessReviewScheduleDefinition.instance.accessReviewInstance.decision.accessReviewInstanceDecisionItem.instance_batchRecordDecision + operationId: identityGovernance.accessReview.definition.instance.decision.instance_batchRecordDecision requestBody: description: Action parameters content: @@ -6554,7 +6554,7 @@ paths: externalDocs: description: Find more info here url: https://learn.microsoft.com/graph/api/accessreviewinstance-resetdecisions?view=graph-rest-beta - operationId: identityGovernance.accessReview.definition.accessReviewScheduleDefinition.instance.accessReviewInstance.decision.accessReviewInstanceDecisionItem.instance_resetDecision + operationId: identityGovernance.accessReview.definition.instance.decision.instance_resetDecision responses: '204': description: Success @@ -6572,7 +6572,7 @@ paths: externalDocs: description: Find more info here url: https://learn.microsoft.com/graph/api/accessreviewinstance-sendreminder?view=graph-rest-beta - operationId: identityGovernance.accessReview.definition.accessReviewScheduleDefinition.instance.accessReviewInstance.decision.accessReviewInstanceDecisionItem.instance_sendReminder + operationId: identityGovernance.accessReview.definition.instance.decision.instance_sendReminder responses: '204': description: Success @@ -6590,7 +6590,7 @@ paths: externalDocs: description: Find more info here url: https://learn.microsoft.com/graph/api/accessreviewinstance-stop?view=graph-rest-beta - operationId: identityGovernance.accessReview.definition.accessReviewScheduleDefinition.instance.accessReviewInstance.decision.accessReviewInstanceDecisionItem.instance_stop + operationId: identityGovernance.accessReview.definition.instance.decision.instance_stop responses: '204': description: Success @@ -6604,7 +6604,7 @@ paths: tags: - identityGovernance.accessReviewSet summary: Invoke action stopApplyDecisions - operationId: identityGovernance.accessReview.definition.accessReviewScheduleDefinition.instance.accessReviewInstance.decision.accessReviewInstanceDecisionItem.instance_stopApplyDecision + operationId: identityGovernance.accessReview.definition.instance.decision.instance_stopApplyDecision responses: '204': description: Success @@ -7140,7 +7140,7 @@ paths: externalDocs: description: Find more info here url: https://learn.microsoft.com/graph/api/accessreviewinstance-list-decisions?view=graph-rest-beta - operationId: identityGovernance.accessReview.definition.accessReviewScheduleDefinition.instance.accessReviewInstance.decision.accessReviewInstanceDecisionItem.instance.stage.accessReviewStage.decision_filterGraphBPreCurrentUser + operationId: identityGovernance.accessReview.definition.instance.decision.instance.stage.decision_filterGraphBPreCurrentUser parameters: - $ref: '#/components/parameters/top' - $ref: '#/components/parameters/skip' @@ -7210,7 +7210,7 @@ paths: externalDocs: description: Find more info here url: https://learn.microsoft.com/graph/api/accessreviewinstancedecisionitem-recordalldecisions?view=graph-rest-beta - operationId: identityGovernance.accessReview.definition.accessReviewScheduleDefinition.instance.accessReviewInstance.decision.accessReviewInstanceDecisionItem.instance.stage.accessReviewStage.decision_recordAllDecision + operationId: identityGovernance.accessReview.definition.instance.decision.instance.stage.decision_recordAllDecision requestBody: description: Action parameters content: @@ -7304,7 +7304,7 @@ paths: externalDocs: description: Find more info here url: https://learn.microsoft.com/graph/api/accessreviewstage-stop?view=graph-rest-beta - operationId: identityGovernance.accessReview.definition.accessReviewScheduleDefinition.instance.accessReviewInstance.decision.accessReviewInstanceDecisionItem.instance.stage.accessReviewStage_stop + operationId: identityGovernance.accessReview.definition.instance.decision.instance.stage_stop responses: '204': description: Success @@ -7338,7 +7338,7 @@ paths: externalDocs: description: Find more info here url: https://learn.microsoft.com/graph/api/accessreviewstage-filterbycurrentuser?view=graph-rest-beta - operationId: identityGovernance.accessReview.definition.accessReviewScheduleDefinition.instance.accessReviewInstance.decision.accessReviewInstanceDecisionItem.instance.stage_filterGraphBPreCurrentUser + operationId: identityGovernance.accessReview.definition.instance.decision.instance.stage_filterGraphBPreCurrentUser parameters: - $ref: '#/components/parameters/top' - $ref: '#/components/parameters/skip' @@ -8887,7 +8887,7 @@ paths: externalDocs: description: Find more info here url: https://learn.microsoft.com/graph/api/accessreviewinstance-list-decisions?view=graph-rest-beta - operationId: identityGovernance.accessReview.definition.accessReviewScheduleDefinition.instance.accessReviewInstance.stage.accessReviewStage.decision.accessReviewInstanceDecisionItem.instance.decision_filterGraphBPreCurrentUser + operationId: identityGovernance.accessReview.definition.instance.stage.decision.instance.decision_filterGraphBPreCurrentUser parameters: - $ref: '#/components/parameters/top' - $ref: '#/components/parameters/skip' @@ -8957,7 +8957,7 @@ paths: externalDocs: description: Find more info here url: https://learn.microsoft.com/graph/api/accessreviewinstancedecisionitem-recordalldecisions?view=graph-rest-beta - operationId: identityGovernance.accessReview.definition.accessReviewScheduleDefinition.instance.accessReviewInstance.stage.accessReviewStage.decision.accessReviewInstanceDecisionItem.instance.decision_recordAllDecision + operationId: identityGovernance.accessReview.definition.instance.stage.decision.instance.decision_recordAllDecision requestBody: description: Action parameters content: @@ -9035,7 +9035,7 @@ paths: externalDocs: description: Find more info here url: https://learn.microsoft.com/graph/api/accessreviewinstance-acceptrecommendations?view=graph-rest-beta - operationId: identityGovernance.accessReview.definition.accessReviewScheduleDefinition.instance.accessReviewInstance.stage.accessReviewStage.decision.accessReviewInstanceDecisionItem.instance_acceptRecommendation + operationId: identityGovernance.accessReview.definition.instance.stage.decision.instance_acceptRecommendation responses: '204': description: Success @@ -9053,7 +9053,7 @@ paths: externalDocs: description: Find more info here url: https://learn.microsoft.com/graph/api/accessreviewinstance-applydecisions?view=graph-rest-beta - operationId: identityGovernance.accessReview.definition.accessReviewScheduleDefinition.instance.accessReviewInstance.stage.accessReviewStage.decision.accessReviewInstanceDecisionItem.instance_applyDecision + operationId: identityGovernance.accessReview.definition.instance.stage.decision.instance_applyDecision responses: '204': description: Success @@ -9104,7 +9104,7 @@ paths: externalDocs: description: Find more info here url: https://learn.microsoft.com/graph/api/accessreviewinstance-batchrecorddecisions?view=graph-rest-beta - operationId: identityGovernance.accessReview.definition.accessReviewScheduleDefinition.instance.accessReviewInstance.stage.accessReviewStage.decision.accessReviewInstanceDecisionItem.instance_batchRecordDecision + operationId: identityGovernance.accessReview.definition.instance.stage.decision.instance_batchRecordDecision requestBody: description: Action parameters content: @@ -9142,7 +9142,7 @@ paths: externalDocs: description: Find more info here url: https://learn.microsoft.com/graph/api/accessreviewinstance-resetdecisions?view=graph-rest-beta - operationId: identityGovernance.accessReview.definition.accessReviewScheduleDefinition.instance.accessReviewInstance.stage.accessReviewStage.decision.accessReviewInstanceDecisionItem.instance_resetDecision + operationId: identityGovernance.accessReview.definition.instance.stage.decision.instance_resetDecision responses: '204': description: Success @@ -9160,7 +9160,7 @@ paths: externalDocs: description: Find more info here url: https://learn.microsoft.com/graph/api/accessreviewinstance-sendreminder?view=graph-rest-beta - operationId: identityGovernance.accessReview.definition.accessReviewScheduleDefinition.instance.accessReviewInstance.stage.accessReviewStage.decision.accessReviewInstanceDecisionItem.instance_sendReminder + operationId: identityGovernance.accessReview.definition.instance.stage.decision.instance_sendReminder responses: '204': description: Success @@ -9178,7 +9178,7 @@ paths: externalDocs: description: Find more info here url: https://learn.microsoft.com/graph/api/accessreviewinstance-stop?view=graph-rest-beta - operationId: identityGovernance.accessReview.definition.accessReviewScheduleDefinition.instance.accessReviewInstance.stage.accessReviewStage.decision.accessReviewInstanceDecisionItem.instance_stop + operationId: identityGovernance.accessReview.definition.instance.stage.decision.instance_stop responses: '204': description: Success @@ -9192,7 +9192,7 @@ paths: tags: - identityGovernance.accessReviewSet summary: Invoke action stopApplyDecisions - operationId: identityGovernance.accessReview.definition.accessReviewScheduleDefinition.instance.accessReviewInstance.stage.accessReviewStage.decision.accessReviewInstanceDecisionItem.instance_stopApplyDecision + operationId: identityGovernance.accessReview.definition.instance.stage.decision.instance_stopApplyDecision responses: '204': description: Success diff --git a/openApiDocs_KiotaCompat/beta/Notes.yml b/openApiDocs_KiotaCompat/beta/Notes.yml index 55387642110..fc79835fd61 100644 --- a/openApiDocs_KiotaCompat/beta/Notes.yml +++ b/openApiDocs_KiotaCompat/beta/Notes.yml @@ -4757,7 +4757,7 @@ paths: externalDocs: description: Find more info here url: https://learn.microsoft.com/graph/api/page-copytosection?view=graph-rest-beta - operationId: group.onenote.section.onenoteSection.page.onenotePage_copyToSection + operationId: group.onenote.section.page_copyToSection requestBody: description: Action parameters content: @@ -4798,7 +4798,7 @@ paths: tags: - groups.onenote summary: Invoke action onenotePatchContent - operationId: group.onenote.section.onenoteSection.page.onenotePage_onenotePatchContent + operationId: group.onenote.section.page_onenotePatchContent requestBody: description: Action parameters content: @@ -4824,7 +4824,7 @@ paths: tags: - groups.onenote summary: Invoke function preview - operationId: group.onenote.section.onenoteSection.page.onenotePage_preview + operationId: group.onenote.section.page_preview responses: 2XX: description: Success @@ -9746,7 +9746,7 @@ paths: externalDocs: description: Find more info here url: https://learn.microsoft.com/graph/api/page-copytosection?view=graph-rest-beta - operationId: site.onenote.section.onenoteSection.page.onenotePage_copyToSection + operationId: site.onenote.section.page_copyToSection requestBody: description: Action parameters content: @@ -9787,7 +9787,7 @@ paths: tags: - sites.onenote summary: Invoke action onenotePatchContent - operationId: site.onenote.section.onenoteSection.page.onenotePage_onenotePatchContent + operationId: site.onenote.section.page_onenotePatchContent requestBody: description: Action parameters content: @@ -9813,7 +9813,7 @@ paths: tags: - sites.onenote summary: Invoke function preview - operationId: site.onenote.section.onenoteSection.page.onenotePage_preview + operationId: site.onenote.section.page_preview responses: 2XX: description: Success @@ -14772,7 +14772,7 @@ paths: externalDocs: description: Find more info here url: https://learn.microsoft.com/graph/api/page-copytosection?view=graph-rest-beta - operationId: user.onenote.section.onenoteSection.page.onenotePage_copyToSection + operationId: user.onenote.section.page_copyToSection requestBody: description: Action parameters content: @@ -14813,7 +14813,7 @@ paths: tags: - users.onenote summary: Invoke action onenotePatchContent - operationId: user.onenote.section.onenoteSection.page.onenotePage_onenotePatchContent + operationId: user.onenote.section.page_onenotePatchContent requestBody: description: Action parameters content: @@ -14839,7 +14839,7 @@ paths: tags: - users.onenote summary: Invoke function preview - operationId: user.onenote.section.onenoteSection.page.onenotePage_preview + operationId: user.onenote.section.page_preview responses: 2XX: description: Success diff --git a/openApiDocs_KiotaCompat/beta/Planner.yml b/openApiDocs_KiotaCompat/beta/Planner.yml index 1017c06265b..ae762ea2579 100644 --- a/openApiDocs_KiotaCompat/beta/Planner.yml +++ b/openApiDocs_KiotaCompat/beta/Planner.yml @@ -1158,7 +1158,7 @@ paths: externalDocs: description: Find more info here url: https://learn.microsoft.com/graph/api/plannertaskchatmessage-setreaction?view=graph-rest-beta - operationId: group.planner.plan.plannerPlan.bucket.plannerBucket.task.plannerTask.message.plannerTaskChatMessage_setReaction + operationId: group.planner.plan.bucket.task.message_setReaction requestBody: description: Action parameters content: @@ -1186,7 +1186,7 @@ paths: externalDocs: description: Find more info here url: https://learn.microsoft.com/graph/api/plannertaskchatmessage-unsetreaction?view=graph-rest-beta - operationId: group.planner.plan.plannerPlan.bucket.plannerBucket.task.plannerTask.message.plannerTaskChatMessage_unsetReaction + operationId: group.planner.plan.bucket.task.message_unsetReaction requestBody: description: Action parameters content: @@ -1338,7 +1338,7 @@ paths: externalDocs: description: Find more info here url: https://learn.microsoft.com/graph/api/plannertask-delta?view=graph-rest-beta - operationId: group.planner.plan.plannerPlan.bucket.plannerBucket.task_delta + operationId: group.planner.plan.bucket.task_delta parameters: - $ref: '#/components/parameters/top' - $ref: '#/components/parameters/skip' @@ -1424,7 +1424,7 @@ paths: externalDocs: description: Find more info here url: https://learn.microsoft.com/graph/api/plannerbucket-delta?view=graph-rest-beta - operationId: group.planner.plan.plannerPlan.bucket_delta + operationId: group.planner.plan.bucket_delta parameters: - $ref: '#/components/parameters/top' - $ref: '#/components/parameters/skip' @@ -2495,7 +2495,7 @@ paths: externalDocs: description: Find more info here url: https://learn.microsoft.com/graph/api/plannertaskchatmessage-setreaction?view=graph-rest-beta - operationId: group.planner.plan.plannerPlan.task.plannerTask.message.plannerTaskChatMessage_setReaction + operationId: group.planner.plan.task.message_setReaction requestBody: description: Action parameters content: @@ -2523,7 +2523,7 @@ paths: externalDocs: description: Find more info here url: https://learn.microsoft.com/graph/api/plannertaskchatmessage-unsetreaction?view=graph-rest-beta - operationId: group.planner.plan.plannerPlan.task.plannerTask.message.plannerTaskChatMessage_unsetReaction + operationId: group.planner.plan.task.message_unsetReaction requestBody: description: Action parameters content: @@ -2675,7 +2675,7 @@ paths: externalDocs: description: Find more info here url: https://learn.microsoft.com/graph/api/plannertask-delta?view=graph-rest-beta - operationId: group.planner.plan.plannerPlan.task_delta + operationId: group.planner.plan.task_delta parameters: - $ref: '#/components/parameters/top' - $ref: '#/components/parameters/skip' @@ -3693,7 +3693,7 @@ paths: externalDocs: description: Find more info here url: https://learn.microsoft.com/graph/api/plannertaskchatmessage-setreaction?view=graph-rest-beta - operationId: planner.bucket.plannerBucket.task.plannerTask.message.plannerTaskChatMessage_setReaction + operationId: planner.bucket.task.message_setReaction requestBody: description: Action parameters content: @@ -3721,7 +3721,7 @@ paths: externalDocs: description: Find more info here url: https://learn.microsoft.com/graph/api/plannertaskchatmessage-unsetreaction?view=graph-rest-beta - operationId: planner.bucket.plannerBucket.task.plannerTask.message.plannerTaskChatMessage_unsetReaction + operationId: planner.bucket.task.message_unsetReaction requestBody: description: Action parameters content: @@ -3873,7 +3873,7 @@ paths: externalDocs: description: Find more info here url: https://learn.microsoft.com/graph/api/plannertask-delta?view=graph-rest-beta - operationId: planner.bucket.plannerBucket.task_delta + operationId: planner.bucket.task_delta parameters: - $ref: '#/components/parameters/top' - $ref: '#/components/parameters/skip' @@ -6254,7 +6254,7 @@ paths: externalDocs: description: Find more info here url: https://learn.microsoft.com/graph/api/plannertaskchatmessage-setreaction?view=graph-rest-beta - operationId: planner.plan.plannerPlan.bucket.plannerBucket.task.plannerTask.message.plannerTaskChatMessage_setReaction + operationId: planner.plan.bucket.task.message_setReaction requestBody: description: Action parameters content: @@ -6282,7 +6282,7 @@ paths: externalDocs: description: Find more info here url: https://learn.microsoft.com/graph/api/plannertaskchatmessage-unsetreaction?view=graph-rest-beta - operationId: planner.plan.plannerPlan.bucket.plannerBucket.task.plannerTask.message.plannerTaskChatMessage_unsetReaction + operationId: planner.plan.bucket.task.message_unsetReaction requestBody: description: Action parameters content: @@ -6434,7 +6434,7 @@ paths: externalDocs: description: Find more info here url: https://learn.microsoft.com/graph/api/plannertask-delta?view=graph-rest-beta - operationId: planner.plan.plannerPlan.bucket.plannerBucket.task_delta + operationId: planner.plan.bucket.task_delta parameters: - $ref: '#/components/parameters/top' - $ref: '#/components/parameters/skip' @@ -6520,7 +6520,7 @@ paths: externalDocs: description: Find more info here url: https://learn.microsoft.com/graph/api/plannerbucket-delta?view=graph-rest-beta - operationId: planner.plan.plannerPlan.bucket_delta + operationId: planner.plan.bucket_delta parameters: - $ref: '#/components/parameters/top' - $ref: '#/components/parameters/skip' @@ -7601,7 +7601,7 @@ paths: externalDocs: description: Find more info here url: https://learn.microsoft.com/graph/api/plannertaskchatmessage-setreaction?view=graph-rest-beta - operationId: planner.plan.plannerPlan.task.plannerTask.message.plannerTaskChatMessage_setReaction + operationId: planner.plan.task.message_setReaction requestBody: description: Action parameters content: @@ -7629,7 +7629,7 @@ paths: externalDocs: description: Find more info here url: https://learn.microsoft.com/graph/api/plannertaskchatmessage-unsetreaction?view=graph-rest-beta - operationId: planner.plan.plannerPlan.task.plannerTask.message.plannerTaskChatMessage_unsetReaction + operationId: planner.plan.task.message_unsetReaction requestBody: description: Action parameters content: @@ -7781,7 +7781,7 @@ paths: externalDocs: description: Find more info here url: https://learn.microsoft.com/graph/api/plannertask-delta?view=graph-rest-beta - operationId: planner.plan.plannerPlan.task_delta + operationId: planner.plan.task_delta parameters: - $ref: '#/components/parameters/top' - $ref: '#/components/parameters/skip' @@ -12070,7 +12070,7 @@ paths: externalDocs: description: Find more info here url: https://learn.microsoft.com/graph/api/plannertaskchatmessage-setreaction?view=graph-rest-beta - operationId: user.planner.plan.plannerPlan.bucket.plannerBucket.task.plannerTask.message.plannerTaskChatMessage_setReaction + operationId: user.planner.plan.bucket.task.message_setReaction requestBody: description: Action parameters content: @@ -12098,7 +12098,7 @@ paths: externalDocs: description: Find more info here url: https://learn.microsoft.com/graph/api/plannertaskchatmessage-unsetreaction?view=graph-rest-beta - operationId: user.planner.plan.plannerPlan.bucket.plannerBucket.task.plannerTask.message.plannerTaskChatMessage_unsetReaction + operationId: user.planner.plan.bucket.task.message_unsetReaction requestBody: description: Action parameters content: @@ -12250,7 +12250,7 @@ paths: externalDocs: description: Find more info here url: https://learn.microsoft.com/graph/api/plannertask-delta?view=graph-rest-beta - operationId: user.planner.plan.plannerPlan.bucket.plannerBucket.task_delta + operationId: user.planner.plan.bucket.task_delta parameters: - $ref: '#/components/parameters/top' - $ref: '#/components/parameters/skip' @@ -12336,7 +12336,7 @@ paths: externalDocs: description: Find more info here url: https://learn.microsoft.com/graph/api/plannerbucket-delta?view=graph-rest-beta - operationId: user.planner.plan.plannerPlan.bucket_delta + operationId: user.planner.plan.bucket_delta parameters: - $ref: '#/components/parameters/top' - $ref: '#/components/parameters/skip' @@ -13407,7 +13407,7 @@ paths: externalDocs: description: Find more info here url: https://learn.microsoft.com/graph/api/plannertaskchatmessage-setreaction?view=graph-rest-beta - operationId: user.planner.plan.plannerPlan.task.plannerTask.message.plannerTaskChatMessage_setReaction + operationId: user.planner.plan.task.message_setReaction requestBody: description: Action parameters content: @@ -13435,7 +13435,7 @@ paths: externalDocs: description: Find more info here url: https://learn.microsoft.com/graph/api/plannertaskchatmessage-unsetreaction?view=graph-rest-beta - operationId: user.planner.plan.plannerPlan.task.plannerTask.message.plannerTaskChatMessage_unsetReaction + operationId: user.planner.plan.task.message_unsetReaction requestBody: description: Action parameters content: @@ -13587,7 +13587,7 @@ paths: externalDocs: description: Find more info here url: https://learn.microsoft.com/graph/api/plannertask-delta?view=graph-rest-beta - operationId: user.planner.plan.plannerPlan.task_delta + operationId: user.planner.plan.task_delta parameters: - $ref: '#/components/parameters/top' - $ref: '#/components/parameters/skip' diff --git a/openApiDocs_KiotaCompat/beta/Security.yml b/openApiDocs_KiotaCompat/beta/Security.yml index eed5cedecb8..e6f5ec76b7d 100644 --- a/openApiDocs_KiotaCompat/beta/Security.yml +++ b/openApiDocs_KiotaCompat/beta/Security.yml @@ -10868,7 +10868,7 @@ paths: tags: - security.dataDiscoveryRoot summary: Invoke function aggregatedAppsDetails - operationId: security.dataDiscovery.cloudAppDiscovery.uploadedStream.cloudAppDiscoveryReport_aggregatedAppsDetail + operationId: security.dataDiscovery.cloudAppDiscovery.uploadedStream_aggregatedAppsDetail parameters: - $ref: '#/components/parameters/top' - $ref: '#/components/parameters/skip' diff --git a/openApiDocs_KiotaCompat/v1.0/Notes.yml b/openApiDocs_KiotaCompat/v1.0/Notes.yml index 97a8bfb3fa4..cffaf201c6e 100644 --- a/openApiDocs_KiotaCompat/v1.0/Notes.yml +++ b/openApiDocs_KiotaCompat/v1.0/Notes.yml @@ -4757,7 +4757,7 @@ paths: externalDocs: description: Find more info here url: https://learn.microsoft.com/graph/api/page-copytosection?view=graph-rest-1.0 - operationId: group.onenote.section.onenoteSection.page.onenotePage_copyToSection + operationId: group.onenote.section.page_copyToSection requestBody: description: Action parameters content: @@ -4798,7 +4798,7 @@ paths: tags: - groups.onenote summary: Invoke action onenotePatchContent - operationId: group.onenote.section.onenoteSection.page.onenotePage_onenotePatchContent + operationId: group.onenote.section.page_onenotePatchContent requestBody: description: Action parameters content: @@ -4824,7 +4824,7 @@ paths: tags: - groups.onenote summary: Invoke function preview - operationId: group.onenote.section.onenoteSection.page.onenotePage_preview + operationId: group.onenote.section.page_preview responses: 2XX: description: Success @@ -9748,7 +9748,7 @@ paths: externalDocs: description: Find more info here url: https://learn.microsoft.com/graph/api/page-copytosection?view=graph-rest-1.0 - operationId: site.onenote.section.onenoteSection.page.onenotePage_copyToSection + operationId: site.onenote.section.page_copyToSection requestBody: description: Action parameters content: @@ -9789,7 +9789,7 @@ paths: tags: - sites.onenote summary: Invoke action onenotePatchContent - operationId: site.onenote.section.onenoteSection.page.onenotePage_onenotePatchContent + operationId: site.onenote.section.page_onenotePatchContent requestBody: description: Action parameters content: @@ -9815,7 +9815,7 @@ paths: tags: - sites.onenote summary: Invoke function preview - operationId: site.onenote.section.onenoteSection.page.onenotePage_preview + operationId: site.onenote.section.page_preview responses: 2XX: description: Success @@ -14774,7 +14774,7 @@ paths: externalDocs: description: Find more info here url: https://learn.microsoft.com/graph/api/page-copytosection?view=graph-rest-1.0 - operationId: user.onenote.section.onenoteSection.page.onenotePage_copyToSection + operationId: user.onenote.section.page_copyToSection requestBody: description: Action parameters content: @@ -14815,7 +14815,7 @@ paths: tags: - users.onenote summary: Invoke action onenotePatchContent - operationId: user.onenote.section.onenoteSection.page.onenotePage_onenotePatchContent + operationId: user.onenote.section.page_onenotePatchContent requestBody: description: Action parameters content: @@ -14841,7 +14841,7 @@ paths: tags: - users.onenote summary: Invoke function preview - operationId: user.onenote.section.onenoteSection.page.onenotePage_preview + operationId: user.onenote.section.page_preview responses: 2XX: description: Success diff --git a/tools/README.md b/tools/README.md index 3f6301e00cc..e74cac842c6 100644 --- a/tools/README.md +++ b/tools/README.md @@ -112,6 +112,20 @@ requests a second view of the same Kiota source with `style=Powershell`, path and HTTP method; none of its schemas, parameters or responses are used. Missing or ambiguous operation-ID mappings fail the refresh rather than silently leaving mixed naming. +The existing ID projection also applies the finite exact module/profile/method/path +corrections in `tools\Utilities\RequiredPathOperationIds.json`. These restore 67 required +bound-operation IDs to the spelling used by their shared directives. They do not change +paths, action/function kinds, schemas, parameters, responses, or other IDs. Normal downloads +use them automatically with `-SingularizeOperationIds`; there is no migration integration +flag, runtime legacy-spec lookup, or change to the ordinary literal directive inventory. + +ID alignment does not resolve Identity.Governance's separate broad-selector overmatch: +88 v1.0 and 182 beta literal matches are new routes absent from the legacy module specs. +Their IDs and routes are intentionally unchanged; narrowing that directive requires a +separate source review rather than relabeling unrelated operations. The normal target also +still contains Notes' malformed shared regex; its approved source repair belongs to the +owning module, not this ID projection. + `TweakOpenApi.ps1 -OperationIdsOnly` then applies the existing preposition and word corrections. This mode does not rewrite success response codes or mark navigation properties read-only. For example, `auditLogs.auditLogRoot.UpdateAuditLogRoot` becomes diff --git a/tools/Tests/KiotaCompatOperationIds.Tests.ps1 b/tools/Tests/KiotaCompatOperationIds.Tests.ps1 index 4e4b53ca978..fcccf36a7f5 100644 --- a/tools/Tests/KiotaCompatOperationIds.Tests.ps1 +++ b/tools/Tests/KiotaCompatOperationIds.Tests.ps1 @@ -146,6 +146,140 @@ Describe 'Kiota-compatible operation ID projection' { } } +Describe 'Required-path operation ID alignment' { + BeforeAll { + $requiredIds = Get-Content (Join-Path $toolsPath 'Utilities\RequiredPathOperationIds.json') -Raw | ConvertFrom-Json + $repoRoot = Split-Path $toolsPath -Parent + $requiredContent = @' +openapi: 3.0.4 +info: + title: DeviceManagement.Enrollment + version: beta +paths: + "/roleManagement/cloudPC/roleDefinitions/{unifiedRoleDefinition-id}/inheritsPermissionsFrom/{unifiedRoleDefinition-id1}/assignedPrincipals(transitive=@transitive,directoryScopeType='@directoryScopeType',directoryScopeId='@directoryScopeId')": + get: + operationId: roleManagement.cloudPC.roleDefinition.unifiedRoleDefinition.inheritsPermissionsFrom.unifiedRoleDefinition_assignedPrincipal + x-ms-docs-operation-type: function + responses: + 2XX: + description: Success + post: + operationId: unrelated_Post + /unrelated: + get: + operationId: unrelated_Get +components: + schemas: + result: + anyOf: + - type: string + - type: integer +'@ + $expectedContent = $requiredContent.Replace( + 'roleManagement.cloudPC.roleDefinition.unifiedRoleDefinition.inheritsPermissionsFrom.unifiedRoleDefinition_assignedPrincipal', + 'roleManagement.cloudPC.roleDefinition.inheritsPermissionsFrom_assignedPrincipal') + } + + BeforeEach { + $casePath = Join-Path $TestDrive ([guid]::NewGuid().ToString()) + $null = New-Item $casePath -ItemType Directory + $specPath = Join-Path $casePath 'DeviceManagement.Enrollment.yml' + [System.IO.File]::WriteAllText($specPath, $requiredContent) + $reference = ConvertFrom-Yaml -Yaml $requiredContent -Ordered + } + + It 'aligns the exact required method/path ID without changing kinds, schemas or other IDs' { + & $setIdsPath -OpenApiFilePath $specPath -OperationIdDocument $reference + [System.IO.File]::ReadAllText($specPath) | Should -BeExactly $expectedContent + & $setIdsPath -OpenApiFilePath $specPath -OperationIdDocument $reference + [System.IO.File]::ReadAllText($specPath) | Should -BeExactly $expectedContent + } + + It 'restores the original literal selector without adding an inventory bridge' { + $selector = [regex]::new('^roleManagement\..*\.roleDefinition\.inheritsPermissionsFrom.*$') + $path = @($reference.paths.Keys | Where-Object { $_ -like '/roleManagement/*' })[0] + $selector.IsMatch($reference.paths[$path].get.operationId) | Should -BeFalse + & $setIdsPath -OpenApiFilePath $specPath -OperationIdDocument $reference + $actual = ConvertFrom-Yaml -Yaml ([System.IO.File]::ReadAllText($specPath)) -Ordered + $selector.IsMatch($actual.paths[$path].get.operationId) | Should -BeTrue + $actual.paths[$path].post.operationId | Should -BeExactly 'unrelated_Post' + $actual.paths['/unrelated'].get.operationId | Should -BeExactly 'unrelated_Get' + } + + It 'does not align a different module or profile' -TestCases @( + @{ Module = 'OtherModule'; Profile = 'beta' } + @{ Module = 'DeviceManagement.Enrollment'; Profile = 'v1.0' } + ) { + param($Module, $Profile) + $content = $requiredContent.Replace('version: beta', "version: $Profile") + $path = Join-Path $casePath "$Module.yml" + [System.IO.File]::WriteAllText($path, $content) + $ref = ConvertFrom-Yaml -Yaml $content -Ordered + & $setIdsPath -OpenApiFilePath $path -OperationIdDocument $ref + [System.IO.File]::ReadAllText($path) | Should -BeExactly $content + } + + It 'preserves line endings and a missing final newline for required IDs' { + $content = $requiredContent.Replace("`r`n", "`n").Replace("`n", "`r`n").TrimEnd("`r", "`n") + [System.IO.File]::WriteAllText($specPath, $content) + & $setIdsPath -OpenApiFilePath $specPath -OperationIdDocument $reference + [System.IO.File]::ReadAllText($specPath) | + Should -BeExactly $expectedContent.Replace("`r`n", "`n").Replace("`n", "`r`n").TrimEnd("`r", "`n") + } + + It 'still requires formatted reference evidence before applying a required-path ID' { + $path = @($reference.paths.Keys | Where-Object { $_ -like '/roleManagement/*' })[0] + $reference.paths[$path].Remove('get') + { & $setIdsPath -OpenApiFilePath $specPath -OperationIdDocument $reference } | + Should -Throw '*Missing formatted operation ID*' + [System.IO.File]::ReadAllText($specPath) | Should -BeExactly $requiredContent + } + + It 'applies required IDs during the existing singularized download without another flag' { + Mock Invoke-WebRequest { + param($Uri, $OutFile) + if ($OutFile) { [System.IO.File]::WriteAllText($OutFile, $requiredContent) } + else { @{ Content = ($reference | ConvertTo-Json -Depth 20) } } + } + & $downloadPath -ModuleName DeviceManagement.Enrollment -ModuleRegex '^roleManagement\.' ` + -GraphVersion beta -OpenApiDocOutput $casePath -SingularizeOperationIds -DeferPruning + [System.IO.File]::ReadAllText($specPath) | Should -BeExactly $expectedContent + Should -Invoke Invoke-WebRequest -Times 2 -Exactly + } + + It 'keeps the finite alignment list unique and limited to the audited 67 operations' { + $requiredIds.Count | Should -Be 67 + @($requiredIds | Group-Object module, profile, method, path | Where-Object Count -gt 1).Count | Should -Be 0 + @($requiredIds | Where-Object { $_.profile -eq 'v1.0' -and $_.module -ne 'Notes' }).Count | Should -Be 0 + @($requiredIds | Where-Object { $_.method -notin @('GET', 'POST') }).Count | Should -Be 0 + } + + It 'reproduces each checked-in required-path ID through ordinary projection' -TestCases @( + @{ Module = 'DeviceManagement'; Profile = 'beta'; Count = 1 } + @{ Module = 'DeviceManagement.Enrollment'; Profile = 'beta'; Count = 3 } + @{ Module = 'Planner'; Profile = 'beta'; Count = 24 } + @{ Module = 'Identity.Governance'; Profile = 'beta'; Count = 20 } + @{ Module = 'Notes'; Profile = 'v1.0'; Count = 9 } + @{ Module = 'Notes'; Profile = 'beta'; Count = 9 } + @{ Module = 'Security'; Profile = 'beta'; Count = 1 } + ) { + param($Module, $Profile, $Count) + $path = Join-Path $repoRoot "openApiDocs_KiotaCompat\$Profile\$Module.yml" + $content = [System.IO.File]::ReadAllText($path) + $ref = ConvertFrom-Yaml -Yaml $content -Ordered + $entries = @($requiredIds | Where-Object { $_.module -ceq $Module -and $_.profile -ceq $Profile }) + $entries.Count | Should -Be $Count + foreach ($entry in $entries) { + $ref.paths[$entry.path][$entry.method.ToLowerInvariant()].operationId | Should -BeExactly $entry.operationId + $ref.paths[$entry.path][$entry.method.ToLowerInvariant()].operationId = "fixture_$([guid]::NewGuid().ToString('N'))" + } + $output = Join-Path $casePath "$Module.yml" + [System.IO.File]::WriteAllText($output, $content) + & $setIdsPath -OpenApiFilePath $output -OperationIdDocument $ref + [System.IO.File]::ReadAllText($output) | Should -BeExactly $content + } +} + Describe 'Operation-ID-only OpenAPI tweaks' { BeforeEach { $casePath = Join-Path $TestDrive ([guid]::NewGuid().ToString()) diff --git a/tools/Utilities/RequiredPathOperationIds.json b/tools/Utilities/RequiredPathOperationIds.json new file mode 100644 index 00000000000..da7b60eb80d --- /dev/null +++ b/tools/Utilities/RequiredPathOperationIds.json @@ -0,0 +1,471 @@ +[ + { + "module": "DeviceManagement", + "profile": "beta", + "method": "POST", + "path": "/deviceManagement/intents/{deviceManagementIntent-id}/updateSettings", + "operationId": "deviceManagement.intent_updateSetting" + }, + { + "module": "DeviceManagement.Enrollment", + "profile": "beta", + "method": "GET", + "path": "/roleManagement/cloudPC/roleDefinitions/{unifiedRoleDefinition-id}/inheritsPermissionsFrom/{unifiedRoleDefinition-id1}/assignedPrincipals(transitive=@transitive,directoryScopeType='@directoryScopeType',directoryScopeId='@directoryScopeId')", + "operationId": "roleManagement.cloudPC.roleDefinition.inheritsPermissionsFrom_assignedPrincipal" + }, + { + "module": "DeviceManagement.Enrollment", + "profile": "beta", + "method": "GET", + "path": "/roleManagement/deviceManagement/roleDefinitions/{unifiedRoleDefinition-id}/inheritsPermissionsFrom/{unifiedRoleDefinition-id1}/assignedPrincipals(transitive=@transitive,directoryScopeType='@directoryScopeType',directoryScopeId='@directoryScopeId')", + "operationId": "roleManagement.deviceManagement.roleDefinition.inheritsPermissionsFrom_assignedPrincipal" + }, + { + "module": "DeviceManagement.Enrollment", + "profile": "beta", + "method": "GET", + "path": "/roleManagement/exchange/roleDefinitions/{unifiedRoleDefinition-id}/inheritsPermissionsFrom/{unifiedRoleDefinition-id1}/assignedPrincipals(transitive=@transitive,directoryScopeType='@directoryScopeType',directoryScopeId='@directoryScopeId')", + "operationId": "roleManagement.exchange.roleDefinition.inheritsPermissionsFrom_assignedPrincipal" + }, + { + "module": "Identity.Governance", + "profile": "beta", + "method": "POST", + "path": "/identityGovernance/accessReviews/definitions/{accessReviewScheduleDefinition-id}/instances/{accessReviewInstance-id}/decisions/{accessReviewInstanceDecisionItem-id}/instance/acceptRecommendations", + "operationId": "identityGovernance.accessReview.definition.instance.decision.instance_acceptRecommendation" + }, + { + "module": "Identity.Governance", + "profile": "beta", + "method": "POST", + "path": "/identityGovernance/accessReviews/definitions/{accessReviewScheduleDefinition-id}/instances/{accessReviewInstance-id}/decisions/{accessReviewInstanceDecisionItem-id}/instance/applyDecisions", + "operationId": "identityGovernance.accessReview.definition.instance.decision.instance_applyDecision" + }, + { + "module": "Identity.Governance", + "profile": "beta", + "method": "POST", + "path": "/identityGovernance/accessReviews/definitions/{accessReviewScheduleDefinition-id}/instances/{accessReviewInstance-id}/decisions/{accessReviewInstanceDecisionItem-id}/instance/batchRecordDecisions", + "operationId": "identityGovernance.accessReview.definition.instance.decision.instance_batchRecordDecision" + }, + { + "module": "Identity.Governance", + "profile": "beta", + "method": "POST", + "path": "/identityGovernance/accessReviews/definitions/{accessReviewScheduleDefinition-id}/instances/{accessReviewInstance-id}/decisions/{accessReviewInstanceDecisionItem-id}/instance/resetDecisions", + "operationId": "identityGovernance.accessReview.definition.instance.decision.instance_resetDecision" + }, + { + "module": "Identity.Governance", + "profile": "beta", + "method": "POST", + "path": "/identityGovernance/accessReviews/definitions/{accessReviewScheduleDefinition-id}/instances/{accessReviewInstance-id}/decisions/{accessReviewInstanceDecisionItem-id}/instance/sendReminder", + "operationId": "identityGovernance.accessReview.definition.instance.decision.instance_sendReminder" + }, + { + "module": "Identity.Governance", + "profile": "beta", + "method": "GET", + "path": "/identityGovernance/accessReviews/definitions/{accessReviewScheduleDefinition-id}/instances/{accessReviewInstance-id}/decisions/{accessReviewInstanceDecisionItem-id}/instance/stages/{accessReviewStage-id}/decisions/filterByCurrentUser(on='{on}')", + "operationId": "identityGovernance.accessReview.definition.instance.decision.instance.stage.decision_filterGraphBPreCurrentUser" + }, + { + "module": "Identity.Governance", + "profile": "beta", + "method": "POST", + "path": "/identityGovernance/accessReviews/definitions/{accessReviewScheduleDefinition-id}/instances/{accessReviewInstance-id}/decisions/{accessReviewInstanceDecisionItem-id}/instance/stages/{accessReviewStage-id}/decisions/recordAllDecisions", + "operationId": "identityGovernance.accessReview.definition.instance.decision.instance.stage.decision_recordAllDecision" + }, + { + "module": "Identity.Governance", + "profile": "beta", + "method": "POST", + "path": "/identityGovernance/accessReviews/definitions/{accessReviewScheduleDefinition-id}/instances/{accessReviewInstance-id}/decisions/{accessReviewInstanceDecisionItem-id}/instance/stages/{accessReviewStage-id}/stop", + "operationId": "identityGovernance.accessReview.definition.instance.decision.instance.stage_stop" + }, + { + "module": "Identity.Governance", + "profile": "beta", + "method": "GET", + "path": "/identityGovernance/accessReviews/definitions/{accessReviewScheduleDefinition-id}/instances/{accessReviewInstance-id}/decisions/{accessReviewInstanceDecisionItem-id}/instance/stages/filterByCurrentUser(on='{on}')", + "operationId": "identityGovernance.accessReview.definition.instance.decision.instance.stage_filterGraphBPreCurrentUser" + }, + { + "module": "Identity.Governance", + "profile": "beta", + "method": "POST", + "path": "/identityGovernance/accessReviews/definitions/{accessReviewScheduleDefinition-id}/instances/{accessReviewInstance-id}/decisions/{accessReviewInstanceDecisionItem-id}/instance/stop", + "operationId": "identityGovernance.accessReview.definition.instance.decision.instance_stop" + }, + { + "module": "Identity.Governance", + "profile": "beta", + "method": "POST", + "path": "/identityGovernance/accessReviews/definitions/{accessReviewScheduleDefinition-id}/instances/{accessReviewInstance-id}/decisions/{accessReviewInstanceDecisionItem-id}/instance/stopApplyDecisions", + "operationId": "identityGovernance.accessReview.definition.instance.decision.instance_stopApplyDecision" + }, + { + "module": "Identity.Governance", + "profile": "beta", + "method": "POST", + "path": "/identityGovernance/accessReviews/definitions/{accessReviewScheduleDefinition-id}/instances/{accessReviewInstance-id}/stages/{accessReviewStage-id}/decisions/{accessReviewInstanceDecisionItem-id}/instance/acceptRecommendations", + "operationId": "identityGovernance.accessReview.definition.instance.stage.decision.instance_acceptRecommendation" + }, + { + "module": "Identity.Governance", + "profile": "beta", + "method": "POST", + "path": "/identityGovernance/accessReviews/definitions/{accessReviewScheduleDefinition-id}/instances/{accessReviewInstance-id}/stages/{accessReviewStage-id}/decisions/{accessReviewInstanceDecisionItem-id}/instance/applyDecisions", + "operationId": "identityGovernance.accessReview.definition.instance.stage.decision.instance_applyDecision" + }, + { + "module": "Identity.Governance", + "profile": "beta", + "method": "POST", + "path": "/identityGovernance/accessReviews/definitions/{accessReviewScheduleDefinition-id}/instances/{accessReviewInstance-id}/stages/{accessReviewStage-id}/decisions/{accessReviewInstanceDecisionItem-id}/instance/batchRecordDecisions", + "operationId": "identityGovernance.accessReview.definition.instance.stage.decision.instance_batchRecordDecision" + }, + { + "module": "Identity.Governance", + "profile": "beta", + "method": "GET", + "path": "/identityGovernance/accessReviews/definitions/{accessReviewScheduleDefinition-id}/instances/{accessReviewInstance-id}/stages/{accessReviewStage-id}/decisions/{accessReviewInstanceDecisionItem-id}/instance/decisions/filterByCurrentUser(on='{on}')", + "operationId": "identityGovernance.accessReview.definition.instance.stage.decision.instance.decision_filterGraphBPreCurrentUser" + }, + { + "module": "Identity.Governance", + "profile": "beta", + "method": "POST", + "path": "/identityGovernance/accessReviews/definitions/{accessReviewScheduleDefinition-id}/instances/{accessReviewInstance-id}/stages/{accessReviewStage-id}/decisions/{accessReviewInstanceDecisionItem-id}/instance/decisions/recordAllDecisions", + "operationId": "identityGovernance.accessReview.definition.instance.stage.decision.instance.decision_recordAllDecision" + }, + { + "module": "Identity.Governance", + "profile": "beta", + "method": "POST", + "path": "/identityGovernance/accessReviews/definitions/{accessReviewScheduleDefinition-id}/instances/{accessReviewInstance-id}/stages/{accessReviewStage-id}/decisions/{accessReviewInstanceDecisionItem-id}/instance/resetDecisions", + "operationId": "identityGovernance.accessReview.definition.instance.stage.decision.instance_resetDecision" + }, + { + "module": "Identity.Governance", + "profile": "beta", + "method": "POST", + "path": "/identityGovernance/accessReviews/definitions/{accessReviewScheduleDefinition-id}/instances/{accessReviewInstance-id}/stages/{accessReviewStage-id}/decisions/{accessReviewInstanceDecisionItem-id}/instance/sendReminder", + "operationId": "identityGovernance.accessReview.definition.instance.stage.decision.instance_sendReminder" + }, + { + "module": "Identity.Governance", + "profile": "beta", + "method": "POST", + "path": "/identityGovernance/accessReviews/definitions/{accessReviewScheduleDefinition-id}/instances/{accessReviewInstance-id}/stages/{accessReviewStage-id}/decisions/{accessReviewInstanceDecisionItem-id}/instance/stop", + "operationId": "identityGovernance.accessReview.definition.instance.stage.decision.instance_stop" + }, + { + "module": "Identity.Governance", + "profile": "beta", + "method": "POST", + "path": "/identityGovernance/accessReviews/definitions/{accessReviewScheduleDefinition-id}/instances/{accessReviewInstance-id}/stages/{accessReviewStage-id}/decisions/{accessReviewInstanceDecisionItem-id}/instance/stopApplyDecisions", + "operationId": "identityGovernance.accessReview.definition.instance.stage.decision.instance_stopApplyDecision" + }, + { + "module": "Notes", + "profile": "beta", + "method": "POST", + "path": "/groups/{group-id}/onenote/sections/{onenoteSection-id}/pages/{onenotePage-id}/copyToSection", + "operationId": "group.onenote.section.page_copyToSection" + }, + { + "module": "Notes", + "profile": "beta", + "method": "POST", + "path": "/groups/{group-id}/onenote/sections/{onenoteSection-id}/pages/{onenotePage-id}/onenotePatchContent", + "operationId": "group.onenote.section.page_onenotePatchContent" + }, + { + "module": "Notes", + "profile": "beta", + "method": "GET", + "path": "/groups/{group-id}/onenote/sections/{onenoteSection-id}/pages/{onenotePage-id}/preview()", + "operationId": "group.onenote.section.page_preview" + }, + { + "module": "Notes", + "profile": "beta", + "method": "POST", + "path": "/sites/{site-id}/onenote/sections/{onenoteSection-id}/pages/{onenotePage-id}/copyToSection", + "operationId": "site.onenote.section.page_copyToSection" + }, + { + "module": "Notes", + "profile": "beta", + "method": "POST", + "path": "/sites/{site-id}/onenote/sections/{onenoteSection-id}/pages/{onenotePage-id}/onenotePatchContent", + "operationId": "site.onenote.section.page_onenotePatchContent" + }, + { + "module": "Notes", + "profile": "beta", + "method": "GET", + "path": "/sites/{site-id}/onenote/sections/{onenoteSection-id}/pages/{onenotePage-id}/preview()", + "operationId": "site.onenote.section.page_preview" + }, + { + "module": "Notes", + "profile": "beta", + "method": "POST", + "path": "/users/{user-id}/onenote/sections/{onenoteSection-id}/pages/{onenotePage-id}/copyToSection", + "operationId": "user.onenote.section.page_copyToSection" + }, + { + "module": "Notes", + "profile": "beta", + "method": "POST", + "path": "/users/{user-id}/onenote/sections/{onenoteSection-id}/pages/{onenotePage-id}/onenotePatchContent", + "operationId": "user.onenote.section.page_onenotePatchContent" + }, + { + "module": "Notes", + "profile": "beta", + "method": "GET", + "path": "/users/{user-id}/onenote/sections/{onenoteSection-id}/pages/{onenotePage-id}/preview()", + "operationId": "user.onenote.section.page_preview" + }, + { + "module": "Notes", + "profile": "v1.0", + "method": "POST", + "path": "/groups/{group-id}/onenote/sections/{onenoteSection-id}/pages/{onenotePage-id}/copyToSection", + "operationId": "group.onenote.section.page_copyToSection" + }, + { + "module": "Notes", + "profile": "v1.0", + "method": "POST", + "path": "/groups/{group-id}/onenote/sections/{onenoteSection-id}/pages/{onenotePage-id}/onenotePatchContent", + "operationId": "group.onenote.section.page_onenotePatchContent" + }, + { + "module": "Notes", + "profile": "v1.0", + "method": "GET", + "path": "/groups/{group-id}/onenote/sections/{onenoteSection-id}/pages/{onenotePage-id}/preview()", + "operationId": "group.onenote.section.page_preview" + }, + { + "module": "Notes", + "profile": "v1.0", + "method": "POST", + "path": "/sites/{site-id}/onenote/sections/{onenoteSection-id}/pages/{onenotePage-id}/copyToSection", + "operationId": "site.onenote.section.page_copyToSection" + }, + { + "module": "Notes", + "profile": "v1.0", + "method": "POST", + "path": "/sites/{site-id}/onenote/sections/{onenoteSection-id}/pages/{onenotePage-id}/onenotePatchContent", + "operationId": "site.onenote.section.page_onenotePatchContent" + }, + { + "module": "Notes", + "profile": "v1.0", + "method": "GET", + "path": "/sites/{site-id}/onenote/sections/{onenoteSection-id}/pages/{onenotePage-id}/preview()", + "operationId": "site.onenote.section.page_preview" + }, + { + "module": "Notes", + "profile": "v1.0", + "method": "POST", + "path": "/users/{user-id}/onenote/sections/{onenoteSection-id}/pages/{onenotePage-id}/copyToSection", + "operationId": "user.onenote.section.page_copyToSection" + }, + { + "module": "Notes", + "profile": "v1.0", + "method": "POST", + "path": "/users/{user-id}/onenote/sections/{onenoteSection-id}/pages/{onenotePage-id}/onenotePatchContent", + "operationId": "user.onenote.section.page_onenotePatchContent" + }, + { + "module": "Notes", + "profile": "v1.0", + "method": "GET", + "path": "/users/{user-id}/onenote/sections/{onenoteSection-id}/pages/{onenotePage-id}/preview()", + "operationId": "user.onenote.section.page_preview" + }, + { + "module": "Planner", + "profile": "beta", + "method": "POST", + "path": "/groups/{group-id}/planner/plans/{plannerPlan-id}/buckets/{plannerBucket-id}/tasks/{plannerTask-id}/messages/{plannerTaskChatMessage-id}/setReaction", + "operationId": "group.planner.plan.bucket.task.message_setReaction" + }, + { + "module": "Planner", + "profile": "beta", + "method": "POST", + "path": "/groups/{group-id}/planner/plans/{plannerPlan-id}/buckets/{plannerBucket-id}/tasks/{plannerTask-id}/messages/{plannerTaskChatMessage-id}/unsetReaction", + "operationId": "group.planner.plan.bucket.task.message_unsetReaction" + }, + { + "module": "Planner", + "profile": "beta", + "method": "GET", + "path": "/groups/{group-id}/planner/plans/{plannerPlan-id}/buckets/{plannerBucket-id}/tasks/delta()", + "operationId": "group.planner.plan.bucket.task_delta" + }, + { + "module": "Planner", + "profile": "beta", + "method": "GET", + "path": "/groups/{group-id}/planner/plans/{plannerPlan-id}/buckets/delta()", + "operationId": "group.planner.plan.bucket_delta" + }, + { + "module": "Planner", + "profile": "beta", + "method": "POST", + "path": "/groups/{group-id}/planner/plans/{plannerPlan-id}/tasks/{plannerTask-id}/messages/{plannerTaskChatMessage-id}/setReaction", + "operationId": "group.planner.plan.task.message_setReaction" + }, + { + "module": "Planner", + "profile": "beta", + "method": "POST", + "path": "/groups/{group-id}/planner/plans/{plannerPlan-id}/tasks/{plannerTask-id}/messages/{plannerTaskChatMessage-id}/unsetReaction", + "operationId": "group.planner.plan.task.message_unsetReaction" + }, + { + "module": "Planner", + "profile": "beta", + "method": "GET", + "path": "/groups/{group-id}/planner/plans/{plannerPlan-id}/tasks/delta()", + "operationId": "group.planner.plan.task_delta" + }, + { + "module": "Planner", + "profile": "beta", + "method": "POST", + "path": "/planner/buckets/{plannerBucket-id}/tasks/{plannerTask-id}/messages/{plannerTaskChatMessage-id}/setReaction", + "operationId": "planner.bucket.task.message_setReaction" + }, + { + "module": "Planner", + "profile": "beta", + "method": "POST", + "path": "/planner/buckets/{plannerBucket-id}/tasks/{plannerTask-id}/messages/{plannerTaskChatMessage-id}/unsetReaction", + "operationId": "planner.bucket.task.message_unsetReaction" + }, + { + "module": "Planner", + "profile": "beta", + "method": "GET", + "path": "/planner/buckets/{plannerBucket-id}/tasks/delta()", + "operationId": "planner.bucket.task_delta" + }, + { + "module": "Planner", + "profile": "beta", + "method": "POST", + "path": "/planner/plans/{plannerPlan-id}/buckets/{plannerBucket-id}/tasks/{plannerTask-id}/messages/{plannerTaskChatMessage-id}/setReaction", + "operationId": "planner.plan.bucket.task.message_setReaction" + }, + { + "module": "Planner", + "profile": "beta", + "method": "POST", + "path": "/planner/plans/{plannerPlan-id}/buckets/{plannerBucket-id}/tasks/{plannerTask-id}/messages/{plannerTaskChatMessage-id}/unsetReaction", + "operationId": "planner.plan.bucket.task.message_unsetReaction" + }, + { + "module": "Planner", + "profile": "beta", + "method": "GET", + "path": "/planner/plans/{plannerPlan-id}/buckets/{plannerBucket-id}/tasks/delta()", + "operationId": "planner.plan.bucket.task_delta" + }, + { + "module": "Planner", + "profile": "beta", + "method": "GET", + "path": "/planner/plans/{plannerPlan-id}/buckets/delta()", + "operationId": "planner.plan.bucket_delta" + }, + { + "module": "Planner", + "profile": "beta", + "method": "POST", + "path": "/planner/plans/{plannerPlan-id}/tasks/{plannerTask-id}/messages/{plannerTaskChatMessage-id}/setReaction", + "operationId": "planner.plan.task.message_setReaction" + }, + { + "module": "Planner", + "profile": "beta", + "method": "POST", + "path": "/planner/plans/{plannerPlan-id}/tasks/{plannerTask-id}/messages/{plannerTaskChatMessage-id}/unsetReaction", + "operationId": "planner.plan.task.message_unsetReaction" + }, + { + "module": "Planner", + "profile": "beta", + "method": "GET", + "path": "/planner/plans/{plannerPlan-id}/tasks/delta()", + "operationId": "planner.plan.task_delta" + }, + { + "module": "Planner", + "profile": "beta", + "method": "POST", + "path": "/users/{user-id}/planner/plans/{plannerPlan-id}/buckets/{plannerBucket-id}/tasks/{plannerTask-id}/messages/{plannerTaskChatMessage-id}/setReaction", + "operationId": "user.planner.plan.bucket.task.message_setReaction" + }, + { + "module": "Planner", + "profile": "beta", + "method": "POST", + "path": "/users/{user-id}/planner/plans/{plannerPlan-id}/buckets/{plannerBucket-id}/tasks/{plannerTask-id}/messages/{plannerTaskChatMessage-id}/unsetReaction", + "operationId": "user.planner.plan.bucket.task.message_unsetReaction" + }, + { + "module": "Planner", + "profile": "beta", + "method": "GET", + "path": "/users/{user-id}/planner/plans/{plannerPlan-id}/buckets/{plannerBucket-id}/tasks/delta()", + "operationId": "user.planner.plan.bucket.task_delta" + }, + { + "module": "Planner", + "profile": "beta", + "method": "GET", + "path": "/users/{user-id}/planner/plans/{plannerPlan-id}/buckets/delta()", + "operationId": "user.planner.plan.bucket_delta" + }, + { + "module": "Planner", + "profile": "beta", + "method": "POST", + "path": "/users/{user-id}/planner/plans/{plannerPlan-id}/tasks/{plannerTask-id}/messages/{plannerTaskChatMessage-id}/setReaction", + "operationId": "user.planner.plan.task.message_setReaction" + }, + { + "module": "Planner", + "profile": "beta", + "method": "POST", + "path": "/users/{user-id}/planner/plans/{plannerPlan-id}/tasks/{plannerTask-id}/messages/{plannerTaskChatMessage-id}/unsetReaction", + "operationId": "user.planner.plan.task.message_unsetReaction" + }, + { + "module": "Planner", + "profile": "beta", + "method": "GET", + "path": "/users/{user-id}/planner/plans/{plannerPlan-id}/tasks/delta()", + "operationId": "user.planner.plan.task_delta" + }, + { + "module": "Security", + "profile": "beta", + "method": "GET", + "path": "/security/dataDiscovery/cloudAppDiscovery/uploadedStreams/{cloudAppDiscoveryReport-id}/microsoft.graph.security.aggregatedAppsDetails(period={period})", + "operationId": "security.dataDiscovery.cloudAppDiscovery.uploadedStream_aggregatedAppsDetail" + } +] diff --git a/tools/Utilities/Set-OpenApiOperationIds.ps1 b/tools/Utilities/Set-OpenApiOperationIds.ps1 index 124a6919e0d..067ebc1778b 100644 --- a/tools/Utilities/Set-OpenApiOperationIds.ps1 +++ b/tools/Utilities/Set-OpenApiOperationIds.ps1 @@ -14,6 +14,16 @@ $content = [System.IO.File]::ReadAllText($OpenApiFilePath) $document = ConvertFrom-Yaml -Yaml $content -Ordered $operationIds = [System.Collections.Generic.Dictionary[string, string]]::new([System.StringComparer]::Ordinal) $methods = @('get', 'put', 'post', 'delete', 'options', 'head', 'patch', 'trace') +$moduleName = [System.IO.Path]::GetFileNameWithoutExtension($OpenApiFilePath) +$requiredIds = [System.Collections.Generic.Dictionary[string, string]]::new([System.StringComparer]::Ordinal) +# These exact required paths have bound-operation IDs whose ancestry differs from the +# shared directive's original ID. Apply finite corrections, not regex or legacy lookup. +$alignments = Get-Content (Join-Path $PSScriptRoot 'RequiredPathOperationIds.json') -Raw | ConvertFrom-Json +foreach ($alignment in $alignments) { + if ($alignment.module -ceq $moduleName -and $alignment.profile -ceq $document.info.version) { + $requiredIds.Add("$($alignment.method) $($alignment.path)", $alignment.operationId) + } +} foreach ($path in $document.paths.GetEnumerator()) { foreach ($method in $methods) { @@ -30,6 +40,10 @@ foreach ($path in $document.paths.GetEnumerator()) { $oldId = $operation.operationId $newId = $OperationIdDocument.paths[$path.Key][$method].operationId + $requiredKey = "$($method.ToUpperInvariant()) $($path.Key)" + if ($requiredIds.ContainsKey($requiredKey)) { + $newId = $requiredIds[$requiredKey] + } if ($operationIds.ContainsKey($oldId) -and $operationIds[$oldId] -cne $newId) { throw "Ambiguous operation ID '$oldId' in '$OpenApiFilePath'." }