Closed (fixed)
Project:
JSON:API Extras
Version:
8.x-2.1
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
27 Jun 2018 at 14:13 UTC
Updated:
15 Sep 2018 at 08:19 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
wim leersThis is why @gabesullice and I hadn't tagged a new JSON API release yet, but @e0ipso tagged that 3 days ago: https://www.drupal.org/project/jsonapi/releases/8.x-1.21.
That's due to the changes committed in #2949632: Make ResourceTypeRepository aware of the path prefix, which were necessary to unblock #2971745: Don't hardcode `/jsonapi/` in FormatSetter, read JSON API base path from container parameter instead. But sadly, the approach in #2971745 causes a performance problem.
The root cause of that performance problem is the original commit in #2949632. If it had used a container parameter, that would not have been a problem. See #2971745-15: Don't hardcode `/jsonapi/` in FormatSetter, read JSON API base path from container parameter instead for an explanation (and the preceding comment for profiling numbers).
I'll work on a
jsonapi_extraspatch that makes it compatible with thejsonapipatch at #2971745-15.Comment #3
ncvrk commentedThanks @Wim Leers, I just looked into it a bit when I noticed my overwritten APIs stopped working after a composer update and threw that patch in the issue overview in case someone else ran into the same thing in the interim on 1.21 jsonapi before an official jsonapi_extras patch.
Comment #4
wim leersComment #5
wim leersThese changes are for #2948666: Remove JSON API's use of $context['cacheable_metadata'], which landed today.
Comment #6
wim leersThese changes are for #2971745-15: Don't hardcode `/jsonapi/` in FormatSetter, read JSON API base path from container parameter instead, which is the proposed patch for
jsonapi, which does NOT suffer from performance problems.Comment #7
wim leersThe patch in #4 should not pass tests because #2971745-15: Don't hardcode `/jsonapi/` in FormatSetter, read JSON API base path from container parameter instead has not yet been committed.
Comment #9
wim leersgit shenanigans… functionally identical to the previous patch.
Comment #11
wim leersActually, it seems
jsonapi_extrasHEAD is broken in multiple ways. Let's see where things fail in HEAD by uploading a patch that just modifies the*.info.ymlfile.Comment #13
e0ipsoThis is a brilliant patch, as usual! Thanks @Wim Leers.
It feels that the subscriber got more responsibilities after it got its name.
Maybe we should break off to JSON API Extras 3.x and:
1. Change the config property to
base_pathto stay consistent with JSON API.2. Include the leading
/in the configuration property (and validate that fact) to stay consistent with JSON API.Comment #14
wim leersHahahahahaha 😅😊 Is it that obvious? :D
Happy to rename. Any suggestions?
OTOH, it is all about JSON API Extras config!
Comment #15
wim leersI'll try to drive this to the finish line.
Comment #16
wim leersSomething seriously weird is going on with static caching in
ConfigurableResourceTypeRepository. I've been debugging it for over an hour.Comment #17
wim leersI've figured out the weirdness in practice; everything works splendidly now in JSON API Extras: I can make a change in the configuration, and it instantly shows up. What is not working great though, is the test. That still fails in the same way. It must be due to some weird static caching bug in the test coverage…
Comment #19
wim leersI just finished literally stepping through the entirety of the route building process, for every stage of
\Drupal\Tests\jsonapi_extras\Functional\JsonExtrasApiFunctionalTest::testRead().Because I can't figure out why
$output = Json::decode($this->drupalGet('/api/articles'));is NULL.Turns out it's because of a fatal error:
GAAAAHHHHHHHH!!!!!!!!!!!!
So I wasted ~3 hours on this because
BrowserTestBase::drupalGet()is braindead wrt error handling plusjsonapi_extrasis not verifying that its dependencies are installed (even though it's irrelevant to this test coverage…).When I install that locally, all tests pass:
(Both on Drupal 8.5 & 8.6.)
Comment #20
wim leersMy only remaining suspicion is that it fails against PHP 7.1 due to #2971040: PHP 7.1 Compatibility Warning. So queued a test against PHP 5.5.
Comment #21
wim leersI can try blaming local failures on infrastructure (although I probably shouldn't!), but I can't blame the patch here not passing tests. Because as DrupalCI's output shows:
… that of course does not yet include #2971745: Don't hardcode `/jsonapi/` in FormatSetter, read JSON API base path from container parameter instead, which was committed only minutes ago, by yours truly. 😅
So, let's make it use the latest version of
jsonapithat includes that commit. I think this should do it. (But this should definitely not get committed.)Comment #22
wim leers🚀🎉
Once a new
jsonapirelease is tagged, we can update the minimum version requirement incomposer.jsonandjsonapi_extras.info.yml(which oddly don't match), and then we'll be good to go! 🤘Comment #23
gabesulliceThe final 1.x release of JSON API just landed, which includes the required comment. We can update Extras to require >= 1.22 then.
Comment #24
wim leersComment #25
wim leersJust marked #2982652: Fatal error in EntityNormalizerTrait after JSONAPI 1.22 update as a duplicate of this.
Comment #27
e0ipsoThanks for the fix! I changed the version to 1.22 on the commit.
Comment #28
wim leers👍
Although I wonder if
jsonapi_extras.info.ymlshouldn't also be updated? Moving back to RTBC for this.Comment #29
e0ipso@Wim Leers given that JSON API Extras relies on composer libraries, and therefore requires that installation method. Do you think #28 is still relevant?
Comment #30
e0ipsoI'm reopening this because this seems to have broken Contenta CMS's intaller:
Comment #31
e0ipsoMake sure the service exists.
Comment #34
e0ipsoComment #36
campsjos commentedHi all,
I getting the same error as #19 after setting a Timestamp or Date Time Field Enhancer to a date field:
Trait 'Shaper\\DataAdaptor\\DataAdaptorValidatorTrait' not found in /xxxx/web/modules/jsonapi_extras/src/Plugin/ResourceFieldEnhancerBase.php on line 25@e0ipso mentioned that this module should be installed via composer, is that true? It can't be installed via backend?
I installed both JSON API and JSON API Extras modules today so all the patches posted here are already commited.
I'm really stuck on this, can anyone give a helping hand? :)
Thanks.
Comment #37
e0ipsoMany hours went into debugging this. This broke Contenta CMS installer using CLI.
Comment #38
e0ipsoComment #40
e0ipso