It seems like after some changes were done in more recent version of JSON API, this module no longer works. I've managed to trace it down to the refactoring of QueryBuilder in JSON API (commit) where \Drupal\jsonapi\Context\CurrentContext::getJsonApiParameter() is no longer used.
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | move_filter_altering-2946892-10.patch | 4.34 KB | mkolar |
Comments
Comment #2
mkolar commentedhello @vtcore thanks for the report but it looks like its bug of latest jsonapi, still investigating.. plase try to disable module and use ?include= manually without using this module.. i've disabled service overrides JsonapiDefaultsServiceProvider here and tried my list of nodes without any argument (like api/content) and it works, when i try to get list of nodes with include to taxonomy term (like api/content?include=keywords) it fails on "Error: Call to a member function isInternal() on null in /var/www/html/docroot/modules/contrib/jsonapi/src/Normalizer/Value/RelationshipNormalizerValue.php on line 120"...when you try to use different include (to different entity) it works (like api/content?include=uid). Can you please confirm?
Comment #3
mkolar commentedComment #4
mkolar commentedThis is an issue of JSONAPI Extras
Comment #5
vtcore commentedHey, thanks for the response.
Unfortunately I cannot reproduce the error you posted and I was more interested in using default filters. My point for
getJsonApiParameter()that is overriden in\Drupal\jsonapi_defaults\JsonApiDefaultsCurrentContextis that it's not called anywhere in jsonapi except in tests. Previously it was used in\Drupal\jsonapi\Query\QueryBuilderwhich was deleted in the commit that I mentioned. This is the reason that default filters are currently broken.I think
\Drupal\jsonapi\Routing\JsonApiParamEnhancer::enhance()can be overriden to inject default params in the request.FYI, these are the module versions that I'm currently using:
Comment #6
mkolar commentedEDIT: OK I get it.. i was too focused to includes, looks like filters are not applied any more. I'll look into it, thanks
Can you explain what exactly is broken? what error do you get? because for me its workingI have
drupal/jsonapi 8.x-1.10drupal/jsonapi_extras 26e1962d91c4730e8a68b78ac15e0184a004ae8bdrupal/jsonapi_defaults 2ffc48e90aa7fdc0f70811b84b2300510af958c1drupal/jsonapi_extras patched withhttps://www.drupal.org/files/issues/2946969--isInternal-on-null--8.patch
Comment #7
mkolar commentedComment #8
mkolar commentedComment #9
mkolar commentedHello @vtcore can you check if this helps?
Comment #10
mkolar commentedComment #11
mkolar commentedComment #12
vtcore commentedWorks great, although I had to remove the version requirement in order to enable the module:
jsonapi:jsonapi (>=8.x-1.10)I got the following error
Module jsonapi_defaults cannot be enabled because it depends on jsonapi (>=8.x-1.10) but is availablebut then found out that's because
jsonapidoesn't have a version in theirjsonapi.info.yml(???)Thanks for the support!
Comment #14
mkolar commented