Repository navigation
Fix contained navigation paths when keys are missing - #3589
Merged
Merged
Conversation
Contributor
Author
|
/AzurePipelines run |
Contributor
Author
|
/AzurePipelines run |
There was a problem hiding this comment.
Pull request overview
Improve contained-navigation path handling in ODataWriterCore by recovering writer-scope paths from explicit @odata.id values when key properties aren’t available, and add scenario coverage to validate relative/absolute IDs, nested collections, and invalid IDs.
Changes:
- Add
TryBuildPathFromResourceIdto parse anODataPathfrom an explicit resource ID. - Update contained-navigation scope path building to fall back to parsing explicit IDs when the existing path/key info is unavailable.
- Add scenario tests for nested contained resources/collections (relative + absolute IDs) and invalid-ID behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| test/UnitTests/Microsoft.OData.Core.Tests/ScenarioTests/Writer/ContainedNavigationPathReproTests.cs | Adds scenario tests validating contained navigation path recovery from explicit IDs (and a negative case). |
| src/Microsoft.OData.Core/ODataWriterCore.cs | Implements path recovery from explicit resource IDs when key/path info is missing while writing contained elements. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
WanjohiSammy
previously approved these changes
Aug 21, 2026
Recover contained writer scope paths from explicit resource IDs when key properties are unavailable. Add scenario coverage for relative, absolute, nested collection, and invalid IDs.
Treat recovered resource IDs as complete only when they target a single resource. When an ID resolves to an entity set or collection, append available key properties before building the contained navigation path. Add regression coverage for a recovered collection path with key properties, while preserving the existing no-duplicate-key coverage for complete resource IDs.
Contributor
Author
|
/AzurePipelines run |
xuzhg
added a commit
that referenced
this pull request
Aug 25, 2026
* Fix contained navigation paths when keys are missing Recover contained writer scope paths from explicit resource IDs when key properties are unavailable. Add scenario coverage for relative, absolute, nested collection, and invalid IDs. * Address contained path review feedback * Handle collection-only resource IDs Treat recovered resource IDs as complete only when they target a single resource. When an ID resolves to an entity set or collection, append available key properties before building the contained navigation path. Add regression coverage for a recovered collection path with key properties, while preserving the existing no-duplicate-key coverage for complete resource IDs.
xuzhg
added a commit
that referenced
this pull request
Aug 25, 2026
Recover contained writer scope paths from explicit resource IDs when key properties are unavailable. Cover relative, absolute, nested collection, invalid, and collection-only IDs. Determine whether a recovered path identifies one resource from the terminal segment's SingleResult and resource target metadata rather than ODataPath.IsCollection, which cannot translate every valid segment kind. This preserves type-cast resource IDs and rejects collection or non-resource paths as complete entity paths. Parse relative explicit IDs with the relative ODataUriParser overload so path recovery works without a service root. Continue requiring a service root for absolute IDs. Add regressions for type-cast IDs, relative IDs without a service root, and collection paths that cannot identify the current resource without a key.
xuzhg
added a commit
that referenced
this pull request
Aug 25, 2026
Recover contained writer scope paths from explicit resource IDs when key properties are unavailable. Cover relative, absolute, nested collection, invalid, and collection-only IDs. Determine whether a recovered path identifies one resource from the terminal segment's SingleResult and resource target metadata rather than ODataPath.IsCollection, which cannot translate every valid segment kind. This preserves type-cast resource IDs and rejects collection or non-resource paths as complete entity paths. Parse relative explicit IDs with the relative ODataUriParser overload so path recovery works without a service root. Continue requiring a service root for absolute IDs. Add regressions for type-cast IDs, relative IDs without a service root, and collection paths that cannot identify the current resource without a key.
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.
Recover contained writer scope paths from explicit resource IDs when key properties are unavailable. Add scenario coverage for relative, absolute, nested collection, and invalid IDs.
Issues
This pull request fixes ADO issue: #3150759.
Description
Briefly describe the changes of this pull request.
Checklist (Uncheck if it is not completed)
Additional work necessary
If documentation update is needed, please add "Docs Needed" label to the issue and provide details about the required document change in the issue.
Repository notes
Team members can start a CI build by adding a comment with the text
/AzurePipelines runto a PR. A bot may respond indicating that there is no pipeline associated with the pull request. This can be ignored if the build is triggered.Team members should not trigger a build this way for pull requests coming from forked repositories. They should instead trigger the build manually by setting the "branch" to
refs/pull/{prId}/mergewhere{prId}is the ID of the PR.