Problem/Motivation

Quoting #2952293: Branch next major: version 2, requiring Drupal core >=8.5:

Move EntityToJsonApi service to jsonapi_extras to consolidate the feature and have more flexibility to evolve that API. This will also have the benefit to remove the only public service from the module, leaving all the PHP API as internal. #2958504: Stop using jsonapi.entity.to_jsonapi service in ResourceTestBase

Quoting @dawehner in #2843147-60: Add JSON:API to core as a stable module.1:

To reduce the API surface of the core module I think it would be fine with moving this to jsonapi_extras. It is not something every decoupled site needs. This way new features can be added more easy

Proposed resolution

Move the EntityToJsonApi service to jsonapi_extras.

Remaining tasks

Do it.

User interface changes

None.

API changes

Smaller PHP API surface.

Data model changes

None.

Comments

Wim Leers created an issue. See original summary.

wim leers’s picture

wim leers’s picture

Status: Needs review » Reviewed & tested by the community

We already have consensus about this among the module maintainers, core maintainers are asking for this, and patch passes tests locally. I'll be bold here for a moment 🤞

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 2: 2982210-2.patch, failed testing. View results

wim leers’s picture

Status: Needs work » Reviewed & tested by the community
StatusFileSize
new1 KB
new12.92 KB

Darn! So close :D

+++ b/tests/src/Functional/ResourceTestBase.php
@@ -181,11 +181,8 @@ abstract class ResourceTestBase extends BrowserTestBase {
-    // Create an account, which tests will use. Also ensure the @current_user
-    // service uses this account, to ensure the @jsonapi.entity.to_jsonapi
-    // service that we use to generate expectations matching that of this user.
+    // Create an account, which tests will use.
     $this->account = $this->createUser();
-    $this->container->get('current_user')->setAccount($this->account);

This is the only change that could possibly cause those failures. Confirmed locally that it fixes the failures.

  • gabesullice committed a966ad2 on 8.x-2.x
    Issue #2982210 by Wim Leers: Move EntityToJsonApi service to JSON API...
gabesullice’s picture

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

Status: Fixed » Closed (fixed)

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

wim leers’s picture