Repository navigation
Preserve endpoints with colliding sanitized path names - #8243
Vincent Biret (baywet) merged 2 commits into
Conversation
|
Shubham Padkonde (@Shubham-Padkonde) your behaviour is disruptive, opening about 30 PRs on the repos in a couple of hours time, most likely code that was AI generated and not tested/reviewed, will only clog our review pipeline. Please stop opening additional pull requests and work on the comments added to existing ones. We have turned on pull requests limits on this repository, and will proceed to blocking you at the organization level if additional pull requests are opened on other repositories before the already opened ones are reviewed and closed/or merged. |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The new collision-resolution loop mixes navigation-name strings with namespace-normalized strings, which can still allow namespace collisions in some cases and should be corrected before approval.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
This PR fixes a Kiota generation bug where sibling static path segments that sanitize to the same navigation name/namespace (e.g. /v1.1 and /v11) would overwrite each other’s request builders, making one endpoint inaccessible and potentially binding the wrong response type.
Changes:
- Introduces a pre-model disambiguation pass over the OpenAPI URL tree to allocate stable
*Escapedsuffixes for colliding static segments while preserving original URL templates. - Threads a separate “code path” (via node
AdditionalData) into namespace generation so descendants remain distinct even when their original segments collide after sanitization. - Adds regression coverage to ensure both colliding endpoints (and an already-existing
Escapedsibling) remain navigable regardless of source path order.
| File | Description |
|---|---|
| tests/Kiota.Builder.Tests/KiotaBuilderTests.PathCollision.cs | Adds regressions validating distinct navigation targets and preserved original URL templates for colliding static segments. |
| src/Kiota.Builder/KiotaBuilder.cs | Runs static-segment disambiguation on the URL tree before building the source model. |
| src/Kiota.Builder/Extensions/OpenApiUrlTreeNodeExtensions.cs | Adds DisambiguateStaticSegments and updates namespace derivation to prefer the disambiguated “code path”. |
| CHANGELOG.md | Documents the new behavior for preserving endpoints with colliding sanitized static segments. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The change is narrowly scoped, includes targeted regressions for the reported collision cases (and ordering), and integrates the disambiguation step at the correct point before code model creation.
Review effort: Lite
Findings: None

Fixes #7143.
Static segments such as /v1.1 and /v11 produce the same navigation name and namespace. Their request builders then overwrite one another, leaving one endpoint inaccessible and potentially exposing the wrong response type.
Resolve sibling collisions before creating the code model. Prefer an already valid segment name, allocate an available Escaped suffix for the conflicting segment, and carry a separate code path through its descendants for namespace generation. Original URI paths remain unchanged. Allocation uses a stable order and reserves existing sibling names so a real v11Escaped endpoint is preserved too.
Four regressions cover both source path orders, with and without an existing suffix name. They check separate navigation targets and both original URL templates; the original two cases fail before the change.
Developed with Codex assistance.
Validation:
This resolves static segment collisions; it does not change the existing merging rules for parameterized paths.