Hello, as it was mentioned here https://www.drupal.org/project/jsonapi_extras/issues/2946790 I have problem with version 8.x-1.10 and extras dev-1.x c2d0f5368a8a19b5aa4f525977ca62d62d7362d6 with patch https://www.drupal.org/files/issues/2946790-2.patch (it doesnt work without patch).. now im getting:

[22-Feb-2018 16:31:48] WARNING: [pool www] child 6 said into stderr: "NOTICE: PHP message: 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 #0 /var/www/html/docroot/modules/contrib/jsonapi/src/Normalizer/Value/RelationshipNormalizerValue.php(98): Drupal\jsonapi\Normalizer\Value\RelationshipNormalizerValue::hasNonInternalResourceType(Array)"
[22-Feb-2018 16:31:48] WARNING: [pool www] child 6 said into stderr: "#1 /var/www/html/docroot/modules/contrib/jsonapi/src/Normalizer/Value/RelationshipNormalizerValue.php(68): Drupal\jsonapi\Normalizer\Value\RelationshipNormalizerValue->getLinks('parent')"
[22-Feb-2018 16:31:48] WARNING: [pool www] child 6 said into stderr: "#2 /var/www/html/docroot/modules/contrib/jsonapi/src/Normalizer/Value/EntityNormalizerValue.php(109): Drupal\jsonapi\Normalizer\Value\RelationshipNormalizerValue->rasterizeValue()"
[22-Feb-2018 16:31:48] WARNING: [pool www] child 6 said into stderr: "#3 /var/www/html/docroot/modules/contrib/jsonapi/src/Normalizer/Value/JsonApiDocumentTopLevelNormalizerValue.php(127): Drupal\jsonapi\Normalizer\Value\EntityNormalizerValue->rasterizeValue()"
[22-Feb-2018 16:31:48] WARNING: [pool www] child 6 said into stderr: "#4 /var/www/html/docroot/modules/contrib/jsonapi/src/Normalizer/Value/J..."

I've found that when i try to access my resource without any include it works, when i try to add include for user (uid) or for example paragraphs which i have in this entity im getting it still works, when I try to add include to categories (reference to taxonomy term) it will fail with error above.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mkolar created an issue. See original summary.

mkolar’s picture

Title: Error: Call to a member function isInternal() » Error: Call to a member function isInternal() on null (RelationshipNormalizerValue.php)
mkolar’s picture

This fixes an issue, but dont know why there is NULL value in the $resource_types array.

gabesullice’s picture

Project: JSON:API » JSON:API Extras
Version: 8.x-1.10 » 8.x-1.x-dev
Status: Active » Needs work

@mkolar, This issue is still in JSON API Extras I believe. It is currently "filtering out" disabled resources. But it should actually be setting them as "internal" per the new strategy in JSON API. It hasn't yet adopted that strategy.

Instead of the ConfigurableResourceTypeRepository just stripping out disabled resources, it should be setting the $internal property on the ResourceType by passing TRUE to the ConfigurableResourceType constructor.

I may be able to work on this soon, but if someone else can do it, that would make it happen much faster! I'm happy to provide reviews/guidance here.

mkolar’s picture

mkolar’s picture

@gabesullice but I have all resources I'm including enabled, I've just checked.. I have disabled taxonomy_vocabulary--taxonomy_vocabulary and also some other taxonomy_term resources but categories resource is enabled (and overridden)..

e0ipso’s picture

@mkolar can you share your request? I can't seem to reproduce this.

e0ipso’s picture

Status: Needs work » Needs review
FileSize
1.21 KB

I think this may work. I was not able to reproduce this, but I have the feeling it's because of this.

@mkolar can you try this patch and see if it works?

bmx269’s picture

The patch in #8 fixed the issue for me.

mkolar’s picture

Status: Needs review » Reviewed & tested by the community

I can also confirm that #8 works.. thanks @e0ipso and @gabesullice...

gabesullice’s picture

Status: Reviewed & tested by the community » Needs work

@e0ipso, I can see why #8 fixed the problem. I think it would be okay to commit this immediately to "unbreak" most people's sites. However, I think you'll definitely need a follow-up.

All the relatable resource type stuff in JSON API operates on the principle that every resource type is present, but may be marked internal. If JSON API Extras does any filtering it's probably going to subtly break something else. I actually tried to build the internal thing in a way that would actually simplify this module :) just by marking a ResourceType as internal, JSON API itself will do the necessary filtering on its own.

gabesullice’s picture

Status: Needs work » Needs review
FileSize
5.24 KB

Behold, simplicity.

e0ipso’s picture

e0ipso’s picture

I need to remove #8 from the patch.

Edit: interdiff was not meant to be a patch 😟

  • e0ipso committed edecde6 on 8.x-1.x
    Issue #2946969 by e0ipso, mkolar, gabesullice, bmx269: Error: Call to a...
e0ipso’s picture

Status: Needs review » Fixed

I merged this because this also fixes the branch tests.

vtcore’s picture

Sorry to reopen this, but after this commit the module cannot be enabled.

The commit adds a version requirement jsonapi:jsonapi (>=8.x-1.10) but jsonapi does not have a version specified in its jsonapi.info.yml.

  • e0ipso committed 46f2ded on 8.x-1.x
    Issue #2946969 by e0ipso, vtcore: Require JSON API 1.10 or later
    
e0ipso’s picture

Thanks for noting that. The version is added by the drupal.org packager.


However, according to: https://www.drupal.org/node/2000204

dependencies - A list of other modules your module depends on. Dependencies should be namespaced in the format {project}:{module}, where {project} is the project name as it appears in the Drupal.org URL (e.g. drupal.org/project/views) and {module} is the module's machine name. Dependencies can also include version restrictions, for examplewebform:webform (>=8.x-5.x). Note that if your module has dependencies on other contributed modules or libraries, these should be declared in the module's composer.json file.

Hence dropping the version range here and adding a composer.json file.

See commit above.

Status: Fixed » Closed (fixed)

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