feat(wrapper-generator): complete v1.0 request-body binding - #3722
Open
Joywambui-maina wants to merge 3 commits into
Open
feat(wrapper-generator): complete v1.0 request-body binding#3722Joywambui-maina wants to merge 3 commits into
Joywambui-maina wants to merge 3 commits into
Conversation
Request bodies bound only top-level primitives, so 4,466 property occurrences across the v1.0 specs had no parameter. Every shape the classifier reaches now binds: referenced models and enums, formatted strings, schema-less UntypedNode values (converted on assignment, nulls dropped to match the published SDK's AddIf), and the numeric INF/NaN union. The invented -Password pair is replaced by the published -PasswordProfile. New gates verify it - omission oracle, coverage sweep, inventory diff, runtime conversions: 0 unbound across all 38 specs, 35 modules build and import, 148 tests. The pre-existing naming-parity gap is tracked separately.
Joywambui-maina
requested a review
from Ramses Sanchez-Hernandez (ramsessanchez)
August 14, 2026 06:48
Contributor
There was a problem hiding this comment.
Pull request overview
This PR upgrades the WrapperGenerator’s request-body parameter binding from “top-level primitives only” to a comprehensive classifier-driven binding model aligned with the Kiota-generated CLR types, and adds documentation + tooling gates to validate binding coverage, runtime conversions, and operation inventory stability.
Changes:
- Introduces exhaustive request-body property classification (scalars, referenced models/enums/collections, schema-less/untyped, excluded-by-policy, unsupported shapes) and wires it into cmdlet emission for New/Update.
- Adds runtime conversion support for schema-less properties via an emitted
UntypedValue.From(object)helper, plus additional generator logging and validation scripts (coverage oracle, measurement sweep, operation inventory diff). - Expands and reorganizes documentation for binding rules and edge cases; updates build/test scripts to support committed wrapper output and validation.
Reviewed changes
Copilot reviewed 22 out of 25 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/WrapperGenerator/StderrLogger.cs | Adds configurable minimum log level for CLI runs. |
| tools/WrapperGenerator/Singularizer.cs | Updates naming-rule commentary and preserves “Whois” behavior rationale. |
| tools/WrapperGenerator/SchemaProperties.cs | Implements request-body property classifier + exclusion/unsupported shape model. |
| tools/WrapperGenerator/README.md | Updates docs to reflect full body binding, committed output layout, and validation gates. |
| tools/WrapperGenerator/Program.cs | Adds --log-level argument and wires it into stderr logging. |
| tools/WrapperGenerator/PowerShellWrapperGenerationService.cs | Integrates classification/binding into New/Update emission and adds reconciliation logging. |
| tools/WrapperGenerator/edge-cases/naming-edge-cases.md | Removes legacy path in favor of docs-based catalog location. |
| tools/WrapperGenerator/docs/edge-cases/naming-edge-cases.md | Extends naming edge-case catalog with additional cases and wrapper-surface change note. |
| tools/WrapperGenerator/docs/edge-cases/kiota-alignment-edge-cases.md | Adds catalog of Kiota-vs-prediction alignment findings and encoded rules. |
| tools/WrapperGenerator/docs/edge-cases/crosspath-merge-edge-cases.md | Documents cross-path cmdlet-variant deferral policy and known cases. |
| tools/WrapperGenerator/docs/edge-cases/body-binding-edge-cases.md | Documents residual unsupported body shapes and why they remain deferred. |
| tools/WrapperGenerator/docs/body-property-binding.md | Adds authoritative binding spec, mapping tables, exclusions, and verification model. |
| tools/WrapperGenerator/CmdletEmitter.cs | Emits complex/untyped parameters + assignments; adds UntypedValue helper and null-safe collection writes. |
| tools/WrapperGenerator.Tests/SpecShapeTests.cs | Adds tests pinning spec/reader behaviors relied on by binding (nav-property extension, nullable ref shape, enum refs). |
| tools/WrapperGenerator.Tests/SchemaPropertiesTests.cs | Adds extensive classifier tests (formats, unions, exclusions, collisions, accounting invariants). |
| tools/WrapperGenerator.Tests/NamingTests.cs | Updates deliberate-correction commentary (contains a small typo). |
| tools/WrapperGenerator.Tests/EmitterTests.cs | Extends emitter tests to cover complex typed parameters and confirms password special-case removal. |
| tools/Test-WrapperModule.ps1 | Adds stale-binary gate + runtime binding checks for complex/enums/scalars/untyped conversion matrix. |
| tools/Test-BodyBindingCoverage.ps1 | Adds independent oracle to ensure every settable Kiota body member is bound or policy-cited. |
| tools/New-WrapperOutputManifest.ps1 | Adds manifest generator for reviewable inventory of committed wrapper output under src/. |
| tools/Measure-BodyPropertyCoverage.ps1 | Adds sweep script summarizing unbound properties by shape across all specs. |
| tools/Compare-WrapperOperationInventory.ps1 | Adds inventory diff tool to ensure parameter-only changes don’t alter generated operations. |
| tools/Compare-WrapperCmdletNames.ps1 | Small doc/comment updates for deliberate correction policy linkage. |
| tools/Build-WrapperModule.ps1 | Adds -IntoSource to write the committed wrapper layout under src/<Module>/<ApiVersion>/wrapper/. |
| .gitignore | Un-ignores src/BackupRestore/ so the module folder can be committed. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
141
to
145
| // Deliberate corrections: the published name is wrong (an AutoRest naming defect) and the | ||
| // generator emits the corrected name instead of reproducing it. Every entry here must have | ||
| // a docs/edge-cases/naming-edge-cases.md entry and a matching row in | ||
| // an docs/edge-cases/naming-edge-cases.md entry and a matching row in | ||
| // Compare-WrapperCmdletNames.ps1's $deliberateCorrections table, so the parity gate | ||
| // reports it as [CORRECTED], not a failure. |
Comment on lines
665
to
668
| public Task AuthenticateRequestAsync(RequestInformation request, Dictionary<string, object>? additionalAuthenticationContext = null, CancellationToken cancellationToken = default) | ||
| { | ||
| request.Headers.TryAdd("Authorization", $"Bearer {_token}"); | ||
| return Task.CompletedTask; |
Comment on lines
+355
to
+362
| private static bool IsNullabilityPlaceholder(IOpenApiSchema schema) => | ||
| (schema.Properties?.Count ?? 0) == 0 | ||
| && (schema.Enum?.Count ?? 0) == 0 | ||
| && schema.Items is null | ||
| && schema.AdditionalProperties is null | ||
| && string.IsNullOrEmpty(schema.Format) | ||
| && (schema.AnyOf?.Count ?? 0) == 0 | ||
| && (schema.OneOf?.Count ?? 0) == 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes proposed in this pull request
INF/NaNunions using their generated Kiota member types.objectand convert them to KiotaUntypedValueinstances during assignment.-Passwordand-ForceChangePasswordNextSignInparameters with the published-PasswordProfilemodel parameter.Scope
This changes property binding only for operations that already generate. It does not add support for skipped actions, functions, unsupported path segments, or operations without a named request entity.
The operation-inventory gate verifies that this change does not alter which operations generate.
Validation
Date, and 19 schema-less value-conversion cases.Dependency
This PR is intentionally based on
feature/wrapper-module-packagingso reviewers see only the 24 files belonging to request-body binding. After #3698 merges intopowershell-v3, this PR will be retargeted topowershell-v3.Closes #3707