Skip to content

Secondary paging #1100

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Nov 4, 2021
Merged

Secondary paging #1100

merged 6 commits into from
Nov 4, 2021

Conversation

bart-degreed
Copy link
Contributor

@bart-degreed bart-degreed commented Nov 3, 2021

Sets last/next paging links and adds meta.total on secondary/relationship endpoint responses when options.IncludeTotalResourceCount is set to true. Supports both one-to-many and many-to-many relationships.

Fixes JSON:API spec compliance by not un-escaping square brackets in response links.
Bugfix: links.next was not set on full page at relationship endpoint.

Fixes #1010.

QUALITY CHECKLIST

  • Changes implemented in code
  • Complies with our contributing guidelines
  • Adapted tests
  • N/A: Documentation updated
  • N/A: Created issue to update Templates: {ISSUE_NUMBER}

@bart-degreed bart-degreed requested a review from maurei November 3, 2021 12:23
Bart Koelman added 3 commits November 3, 2021 14:32
From https://jsonapi.org/format/1.1/#appendix-query-details-square-brackets:
> According to the query parameter serialization rules above, a compliant implementation will percent-encode these square brackets.
…ng inverse relationship

Bugfix: links.next was not set on full page at relationship endpoint
@codecov
Copy link

codecov bot commented Nov 3, 2021

Codecov Report

Merging #1100 (c184efe) into master (f0d638f) will increase coverage by 0.05%.
The diff coverage is 96.36%.

❗ Current head c184efe differs from pull request most recent head c76ff4d. Consider uploading reports for the commit c76ff4d to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1100      +/-   ##
==========================================
+ Coverage   88.54%   88.59%   +0.05%     
==========================================
  Files         255      255              
  Lines        7086     7127      +41     
==========================================
+ Hits         6274     6314      +40     
- Misses        812      813       +1     
Impacted Files Coverage Δ
...iDotNetCore/Queries/Internal/QueryLayerComposer.cs 99.24% <93.54%> (-0.76%) ⬇️
src/JsonApiDotNetCore/CollectionExtensions.cs 53.33% <100.00%> (+1.60%) ⬆️
...otNetCore/Queries/Expressions/LogicalExpression.cs 75.00% <100.00%> (+2.58%) ⬆️
...Core/Repositories/EntityFrameworkCoreRepository.cs 99.25% <100.00%> (ø)
...NetCore/Repositories/ResourceRepositoryAccessor.cs 100.00% <100.00%> (ø)
...piDotNetCore/Serialization/Response/LinkBuilder.cs 98.30% <100.00%> (-0.03%) ⬇️
...onApiDotNetCore/Services/JsonApiResourceService.cs 97.03% <100.00%> (+0.12%) ⬆️
...ueries/Expressions/ResourceFieldChainExpression.cs 100.00% <0.00%> (+4.76%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f0d638f...c76ff4d. Read the comment docs.

@maurei maurei merged commit 4798144 into master Nov 4, 2021
@maurei maurei deleted the secondary-paging branch November 4, 2021 12:18
bart-degreed pushed a commit that referenced this pull request Dec 3, 2021
* JSON:API spec compliance: do not unescape brackets in response
From https://jsonapi.org/format/1.1/#appendix-query-details-square-brackets:
> According to the query parameter serialization rules above, a compliant implementation will percent-encode these square brackets.

* Updated existing IResourceDefinition tests to capture all relevant callbacks

* Retrieve total resource count on secondary/relationship endpoints using inverse relationship
Bugfix: links.next was not set on full page at relationship endpoint

* Rename flags enum to plural

* Clarified documentation; fixed broken link

* Check off roadmap entry
bart-degreed pushed a commit that referenced this pull request Dec 3, 2021
* JSON:API spec compliance: do not unescape brackets in response
From https://jsonapi.org/format/1.1/#appendix-query-details-square-brackets:
> According to the query parameter serialization rules above, a compliant implementation will percent-encode these square brackets.

* Updated existing IResourceDefinition tests to capture all relevant callbacks

* Retrieve total resource count on secondary/relationship endpoints using inverse relationship
Bugfix: links.next was not set on full page at relationship endpoint

* Rename flags enum to plural

* Clarified documentation; fixed broken link

* Check off roadmap entry
bart-degreed pushed a commit that referenced this pull request Dec 3, 2021
* JSON:API spec compliance: do not unescape brackets in response
From https://jsonapi.org/format/1.1/#appendix-query-details-square-brackets:
> According to the query parameter serialization rules above, a compliant implementation will percent-encode these square brackets.

* Updated existing IResourceDefinition tests to capture all relevant callbacks

* Retrieve total resource count on secondary/relationship endpoints using inverse relationship
Bugfix: links.next was not set on full page at relationship endpoint

* Rename flags enum to plural

* Clarified documentation; fixed broken link

* Check off roadmap entry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Improved paging links on secondary endpoint using inverse relationship
2 participants