Ran into this while trying to locally start testing JSON API 2.0.0-beta1. The composer.json in jsonapoi_extras defines the requirement of "drupal/jsonapi": "^1.22",. This implies >=1.22 <2.0.0, so the requirement prevents installation of JSON API 2.0.0, and vice versa.

Comments

logickal created an issue. See original summary.

logickal’s picture

Not knowing what @eoipso plans in terms of version support, here's a quick patch that will allow JSON API and JSON API Extras to co-exist with Composer.

grimreaper’s picture

Hello,

As the JSONAPI 8.x-2.0.0-beta1 is recommended, I also ran into the same problem.

Thanks for the patch.

But even with the patch it prevents installation as the composer.json would be modified by the patch after requirements are checked.

logickal’s picture

Yep, I should have chimed back in here. To get this to work for evaluation and development in one of my local stacks, I had to point the project at a local fork with the patch applied to a new branch.

It’s also worth noting that after instal it becomes obvious that Extras doesn’t play nice with 2.0.0 yet, but I have not had any time to start investigating.

littletiger’s picture

What would need to be done to make it compatible? Composer + working nicely with jsonapi 2.x ?

wim leers’s picture

Issue tags: +API-First Initiative

jsonapi_extras is not yet compatible with jsonapi 2.x. Sorry about that. Expect significant progress soon.

eojthebrave’s picture

It looks like the compatibility with JSON API 2.x was fixed in #3004582: Make JSON API Extras 2.x (next release: 2.10) compatible with JSON API 2.0-beta2. However, the composer.json in the 8.x-2.10 release still includes "drupal/jsonapi": "^1.22". So thus far I'm unable to use composer to install both JSON API 8.x-2.x and JSON API Extras 8.x-2.x together.

Is patching the composer.json file the appropriate change to make now? If so, I'm happy to provide a patch.

ndobromirov’s picture

Priority: Normal » Major

It's impossible to test the compatibility fixes without this.
As the issue for the compatibility is major I am upgrading this to major as well.

wim leers’s picture

Is patching the composer.json file the appropriate change to make now? If so, I'm happy to provide a patch.

I think so. Although please note that JSON API 2.0-beta2 is a few weeks old, and therefore does not yet include #3006270: Add ResourceTypeRepository::createResourceType() for easier JSON API Extras support and simpler code, which is required for JSON API Extras 2.10 to work with JSON API 2.x. We need to tag a new JSON API 2.x release. This is blocked on @e0ipso approving the tagging of a new release.

So for now you would have to manually install JSON API 2.x HEAD (at least commit 54f560dea96c1cdd32165e23639cb19bc588134f, newer is fine too).

eojthebrave’s picture

Okay. Seems like there's a bit of a race condition here where both modules need to get a new release in order to be compatible with one another. JSON API needs a new release to include the commit mentioned above. And JSON API Extras needs a new release to update the composer.json file. Either way, fixing the composer.json file in this module now even without JSON API having a new release is at least no worse than the current situation.

Would it be appropriate to do something like "drupal/jsonapi": "^1.22 || ^2.0-beta3", since JSON API Extras is still compatible with the 8.x-1.x branch of JSON API? I realize there isn't yet a beta3 version of JSON API.

Here's a patch with the proposed change. Let me know if the constraint should be something different. I'm relatively new to using them.

ndobromirov’s picture

Status: Active » Needs review

I would RTBC that if the tag was there.

wim leers’s picture

logickal’s picture

@wim-leers beat me to it - but I think that the `rc-1` designation isn't strictly needed, as specifying version 2.0 installs the rc and will install the release when it lands. At risk of cluttering the issue with patches, uploading my version as well.

logickal’s picture

Oooops, ignore #13, I renamed the wrong local patch.

logickal’s picture

  • e0ipso committed 217b407 on 8.x-2.x authored by logickal
    Issue #2994885 by logickal, Wim Leers, eojthebrave, ndobromirov,...
  • e0ipso committed 6a718b2 on 8.x-2.x authored by Wim Leers
    Issue #2994885 by logickal, Wim Leers, eojthebrave, ndobromirov,...
  • e0ipso committed c1fe8bb on 8.x-2.x authored by eojthebrave
    Issue #2994885 by logickal, Wim Leers, eojthebrave, ndobromirov,...
e0ipso’s picture

I didn't really know who to credit for this. I gave credit to everyone here.

e0ipso’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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