Skip to content

Resource inheritance: can't include derived types after create resource #1640

Closed
@bkoelman

Description

@bkoelman

DESCRIPTION

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

POST /vehicles?include=lights

{ ... }

fails with status 500 (Internal Error):

{
  "links": {
    "self": "http://localhost/vehicles?include=lights"
  },
  "errors": [
    {
      "id": "84b108ae-c1a7-4eaa-9b96-3f239a5c2201",
      "status": "500",
      "title": "An unhandled error occurred while processing this request.",
      "detail": "Property 'System.Collections.Generic.ISet`1[Models.BicycleLight] Lights' is not defined for type 'Models.Vehicle' (Parameter 'property')"
    }
  ],
  "included": []
}

EXPECTED BEHAVIOR

No error, the response includes the related resources.

ACTUAL BEHAVIOR

Crash.

VERSIONS USED

  • JsonApiDotNetCore version: 5.6.0
  • ASP.NET Core version: 8.0
  • Entity Framework Core version: 8.0
  • Database provider: N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions