Skip to content

Commit 3f99034

Browse files
Merge feature/wrapper-module-packaging into feat/bind-request-body-properties
2 parents e287a91 + 1b6f282 commit 3f99034

3 files changed

Lines changed: 8 additions & 5 deletions

File tree

‎tools/Build-WrapperModule.ps1‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ function Build-OneModule {
168168
$result.FailedAt = 'wrapper-generator'
169169
$lines = @($wrapperOut | ForEach-Object { "$_" })
170170
$exception = $lines | Where-Object { $_ -match 'Unhandled exception|Exception:' } | Select-Object -First 1
171-
$exceptionIndex = if ($exception) { $lines.IndexOf($exception) } else { -1 }
171+
$exceptionIndex = if ($exception) { [Array]::IndexOf($lines, $exception) } else { -1 }
172172
$result.Error = if ($exceptionIndex -ge 0) {
173173
($lines[$exceptionIndex..([Math]::Min($exceptionIndex + 5, $lines.Count - 1))] | Where-Object { $_ -notmatch '^\s+at ' }) -join ' | '
174174
} else {

‎tools/WrapperGenerator/PowerShellWrapperGenerationService.cs‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,12 @@ private async Task<int> EmitGetOperationsAsync(List<GetOperationRecord> getOpera
329329

330330
private async Task<int> WriteCmdletFileAsync(CmdletNaming naming, string source, CancellationToken cancellationToken)
331331
{
332-
var fileName = naming.ClassName.Replace("Command", "", StringComparison.Ordinal) + ".g.cs";
332+
const string cmdletClassSuffix = "Command";
333+
var className = naming.ClassName;
334+
var fileBaseName = className.EndsWith(cmdletClassSuffix, StringComparison.Ordinal)
335+
? className[..^cmdletClassSuffix.Length]
336+
: className;
337+
var fileName = fileBaseName + ".g.cs";
333338
// Both colliding cmdlets usually share the same name, so the builder expression (the
334339
// request path) is what actually identifies which two operations collided.
335340
var cmdletName = $"{naming.VerbName}-{naming.Noun} [{naming.BuilderExpression}]";

‎tools/WrapperGenerator/README.md‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,7 @@ dotnet test tools/WrapperGenerator.Tests
219219

220220
The unit tests guard the naming and classification rules (their expected values are real published names from `src/Authentication/Authentication/custom/common/MgCommandMetadata.json`). The parity gate checks actual generated output against that same inventory; names on the deliberate-corrections list ([docs/edge-cases/naming-edge-cases.md](docs/edge-cases/naming-edge-cases.md)) are reported as `[CORRECTED]` instead of failing.
221221

222-
The generated cmdlets **are** compiled: `Build-WrapperModule.ps1` builds each module against the kiota client it was generated with, the only authority on whether an emitted parameter's CLR type matches the member it assigns. Compilation cannot see an *omitted* member, so the omission oracle exists separately; neither can see whether PowerShell converts a value at runtime, so the runtime gate exists separately again.
223-
224-
**Known failing gate at this commit:** the naming parity gate reports 5,689 of 7,434 comparable names matching the published SDK. Those mismatches predate this change (this commit's only naming edit is a doc-path comment) and are tracked for a separate oracle-derived naming change; they are disclosed here rather than hidden from the gate list.
222+
The generated cmdlets **are** compiled: `Build-WrapperModule.ps1` builds each module against the kiota client it was generated with, the only authority on whether an emitted parameter's CLR type matches the member it assigns. Compilation cannot see an *omitted* member, so the omission oracle exists separately; neither can see whether PowerShell converts a value at runtime, so the runtime gate exists separately again. Naming parity is enforced independently by `Compare-WrapperCmdletNames.ps1`.
225223

226224
## Gaps / not done yet
227225

0 commit comments

Comments
 (0)