Skip to content
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

Resource inheritance: can't use relationships from derived types in pagination chain #1642

Open
bkoelman opened this issue Nov 26, 2024 · 0 comments
Labels

Comments

@bkoelman
Copy link
Member

bkoelman commented Nov 26, 2024

DESCRIPTION

Using the models described in #1639, the following request:

GET /manufacturers/1?include=vehicles.lights&page[size]=vehicles.lights:5

fails with the following error:

{
  "links": {
    "self": "/manufacturers/1?include=vehicles.lights&page[size]=vehicles.lights:5"
  },
  "errors": [
    {
      "id": "b5aa9a5d-3b54-4076-bf3a-599894fbd924",
      "status": "400",
      "title": "The specified pagination is invalid.",
      "detail": "Field 'lights' does not exist on resource type 'vehicles'. Failed at position 10: vehicles.^lights:5",
      "source": {
        "parameter": "page[size]"
      }
    }
  ],
  "included": []
}

This scenario has been overlooked when #1142 was implemented.

Once this is fixed, the test Can_get_primary_resource_with_derived_includes can be simplified to create fewer resources and specify a page size lower than the default (10) for the related resources.

EXPECTED BEHAVIOR

Relationship chains in pagination expressions can reference relationships in derived types. Should handle the ShoppingBasket case from #1142 similarly to how it works with includes, so it won't cause failure.

ACTUAL BEHAVIOR

Error 400.

VERSIONS USED

  • JsonApiDotNetCore version: latest master at 0c79d35
  • ASP.NET Core version: 8.0
  • Entity Framework Core version: 8.0
  • Database provider: N/A
@bkoelman bkoelman added the bug label Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

1 participant