The normalizers/other logic may rely on the attributes usually presented in a request during the normal query of JSON API resource. The $context['resource_type'] contains the type of resource for an entity that's currently in process, while $request->attributes->get('resource_type') contains the resource of a top-level entity. Also, providing the _is_jsonapi to the list of attributes will make the use of \Drupal\jsonapi\Routing\Routes::getResourceTypeNameFromParameters() possible.

Comments

BR0kEN created an issue. See original summary.

br0ken’s picture

Assigned: br0ken » Unassigned
Status: Active » Needs review
StatusFileSize
new2.78 KB
e0ipso’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new2.79 KB
new1.57 KB

AWESOME!

Adding some minor changes before commit.

  • e0ipso committed 091a0d5 on 8.x-2.x authored by BR0kEN
    Issue #2995115 by e0ipso, BR0kEN: Provide resource type and an entity...
e0ipso’s picture

Status: Reviewed & tested by the community » Fixed
e0ipso’s picture

@BR0kEN now that you are on fire, maybe you can knock this off pretty easily? #2995142: Support includes the EntityToJsonapi service

In any case, thanks for being so great!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.