Handle inline arrays on trailing-slash paths - #8011
Open
AayushP123 wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
🟢 Ready to approve
The fix is narrowly scoped, addresses the reported failure mode, and includes a targeted regression test validating the behavior.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Pull request overview
Fixes a Kiota client-generation failure for trailing-slash paths (e.g., /test/) whose responses return an array of inline objects by ensuring inline model naming falls back to the existing EmptyPathSegment placeholder instead of producing an empty declaration name.
Changes:
- Extended
OpenApiUrlTreeNodeExtensions.GetClassNameto accept an optionalplaceholderfallback used when the computed segment name is empty. - Applied the trailing-slash placeholder when deriving names for regular, inherited, and composed inline model declarations during model creation.
- Added a regression test covering an inline object array response from a trailing-slash path, plus a changelog entry.
File summaries
| File | Description |
|---|---|
| tests/Kiota.Builder.Tests/KiotaBuilderTests.cs | Adds regression coverage for /test/ returning an array of inline objects and verifies the inline model uses the trailing-slash placeholder name. |
| src/Kiota.Builder/KiotaBuilder.cs | Passes the trailing-slash placeholder into inline model naming paths (regular/inherited/composed) to prevent empty declaration names. |
| src/Kiota.Builder/Extensions/OpenApiUrlTreeNodeExtensions.cs | Adds a placeholder parameter to GetClassName and routes it to the shared segment-name logic. |
| CHANGELOG.md | Documents the fix for trailing-slash inline-object-array generation. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 0
- Review effort level: Lite
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
AayushP123
force-pushed
the
agent/fix-7876-trailing-slash-inline-array
branch
from
August 1, 2026 09:10
55f9d7e to
ccee208
Compare
AayushP123
marked this pull request as ready for review
August 2, 2026 08:39
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.
Summary
Fixes #7876.
Uses the existing
EmptyPathSegmentplaceholder when naming inline response models on trailing-slash paths. Without a fallback name, arrays of inline objects reachedFindChildByNamewith an empty declaration name and aborted generation.Changes
GetClassNamecallers to provide a fallback for empty path segments./test/.Testing
go test ./...on the generated client with Go 1.26.5.dotnet format whitespace kiota.slnx --no-restore --verify-no-changes --include src/Kiota.Builder/Extensions/OpenApiUrlTreeNodeExtensions.cs src/Kiota.Builder/KiotaBuilder.cs tests/Kiota.Builder.Tests/KiotaBuilderTests.csdotnet test tests/Kiota.Builder.Tests/Kiota.Builder.Tests.csproj --no-restore(2,191 passed, 2 skipped)