Skip to content

Fix issue for nested next page link with singleton containment navigation property - #710

Merged
lisicase merged 17 commits into
OData:mainfrom
lisicase:issue701
Oct 6, 2022
Merged

Fix issue for nested next page link with singleton containment navigation property#710
lisicase merged 17 commits into
OData:mainfrom
lisicase:issue701

Conversation

@lisicase

@lisicase lisicase commented Sep 30, 2022

Copy link
Copy Markdown
Contributor

Issues

This pull request fixes Issue #701.

Issue Summary: When expanding a singleton (with AutoExpand and Contained attributes) where a contained collection has a limited page size, results are truncated without a nextLink and end promptly after that truncation--without finishing in valid JSON.

Description

Fix: Check for singletons when generating a path to a contained navigation property (so that the singleton is not skipped when looking for the shortest link to said nav property).

Tests: Two units & one E2E.

@ghost

ghost commented Sep 30, 2022

Copy link
Copy Markdown

CLA assistant check
All CLA requirements met.

@lisicase lisicase changed the title Issue701 Fix for Issue 701 Sep 30, 2022
@lisicase
lisicase marked this pull request as ready for review September 30, 2022 06:57
@lisicase
lisicase requested a review from xuzhg September 30, 2022 06:57
Comment thread src/Microsoft.AspNetCore.OData/Formatter/LinkGenerationHelpers.cs Outdated
Comment thread test/Microsoft.AspNetCore.OData.E2E.Tests/Singleton/SingletonDataModel.cs Outdated
Comment thread test/Microsoft.AspNetCore.OData.E2E.Tests/Singleton/SingletonDataModel.cs Outdated
Comment thread test/Microsoft.AspNetCore.OData.E2E.Tests/Singleton/SingletonDataModel.cs Outdated
Comment thread test/Microsoft.AspNetCore.OData.E2E.Tests/Singleton/SingletonEdmModel.cs Outdated
Comment thread test/Microsoft.AspNetCore.OData.E2E.Tests/Singleton/SingletonDataModel.cs Outdated
Comment thread test/Microsoft.AspNetCore.OData.E2E.Tests/Singleton/SingletonTest.cs Outdated
Comment thread test/Microsoft.AspNetCore.OData.Tests/Formatter/LinkGenerationHelpersTest.cs Outdated
@xuzhg

xuzhg commented Sep 30, 2022

Copy link
Copy Markdown
Member

Rename the PR title

@lisicase lisicase changed the title Fix for Issue 701 Fix issue for nested next page link with singleton containment navigation property Sep 30, 2022
Comment thread src/Microsoft.AspNetCore.OData/Microsoft.AspNetCore.OData.xml
Comment thread test/Microsoft.AspNetCore.OData.E2E.Tests/Singleton/SingletonTest.cs Outdated
Comment thread test/Microsoft.AspNetCore.OData.E2E.Tests/Singleton/SingletonTest.cs Outdated
Comment thread test/Microsoft.AspNetCore.OData.E2E.Tests/Singleton/SingletonTest.cs Outdated
Comment thread test/Microsoft.AspNetCore.OData.Tests/Formatter/LinkGenerationHelpersTest.cs Outdated
Comment thread test/Microsoft.AspNetCore.OData.Tests/Formatter/LinkGenerationHelpersTest.cs Outdated
Comment thread test/Microsoft.AspNetCore.OData.Tests/Formatter/LinkGenerationHelpersTest.cs Outdated
Comment thread test/Microsoft.AspNetCore.OData.Tests/Formatter/LinkGenerationHelpersTest.cs Outdated
currentNavigationSource = navigationPathSegment.NavigationSource;
}

var singletonPathSegment = pathSegment as SingletonSegment;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we want to have an INavigationSourceSegment interface or something and have EntitySetSegment, NavigationPropertySegment, and SingletonSegment implement it so that there is a consistent way to retrieve the "navigation source" from a segment. Doing this would also allow us to always cast only 1 time.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this would involve a change to another repo, this could be a good feature for the future.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, if you've talked to others and think is the path we actually want to go, can you create a github issue for it? If we aren't going that route, you can resolve this

corranrogue9
corranrogue9 previously approved these changes Oct 3, 2022
Co-authored-by: Garrett DeBruin <corranrogue9@gmail.com>
@mikepizzo

Copy link
Copy Markdown
Contributor

Note: this change will also likely need to be ported to the OData/AspNet repo..

xuzhg
xuzhg previously approved these changes Oct 4, 2022
@xuzhg
xuzhg requested review from KenitoInc and gathogojr October 4, 2022 16:59
@lisicase
lisicase marked this pull request as draft October 4, 2022 18:23
@lisicase
lisicase marked this pull request as ready for review October 5, 2022 18:45
@lisicase
lisicase requested a review from xuzhg October 6, 2022 15:42

@mikepizzo mikepizzo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@lisicase
lisicase merged commit 128b5b4 into OData:main Oct 6, 2022
@lisicase
lisicase deleted the issue701 branch October 6, 2022 22:29
@mikepizzo

mikepizzo commented Oct 7, 2022 via email

Copy link
Copy Markdown
Contributor

@robertmclaws

Copy link
Copy Markdown
Contributor

🙌🙌🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@odata.nextLink does not showup when registering EDM as Singleton with property having AutoExpand and Contained and query using $expand

5 participants