Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
requiring the module with composer generates an error because of the jsonapi dependency of the contrib module.
Change this to the core version.
Comment | File | Size | Author |
---|---|---|---|
#2 | allow_drupal_core_install_3066962.patch | 405 bytes | yobottehg |
Comments
Comment #2
yobottehg CreditAttribution: yobottehg commentedhere the needed change.
Comment #3
mglamanIt would be better to provide a
composer.json
so that info.yml does not have to be parsed.drupal/jsonapi
package maps to contrib and core as appropriate.EDIT: I am wrong, the namespaced dependency change also needs to be changed. The above is still more declarative versus the automatic composer.json generation based off of info.yml
Comment #4
hussainweb@mglaman, are you saying that the patch is more declarative? If so, I agree. I don't really see the need for composer.json here. I have seen a module's composer.json drift from the info.yml often.
Comment #5
mglamanI'll kick back to Needs Review. I strongly believe the composer.json should be used instead of the Composer facade dynamically generating one off of the info.yml, but that's the maintainer's call.
Comment #6
sashainparisWell, well...
I am using composer where I declared
"jsonapi_boost": "^1.0"
as a requirement. So I get it :-)From my understanding, composer manage code dependencies while info file manage application dependencies. As a consequence, even if Drupal try to manage code dependencies through info file, it went wrong.
As I use composer, I want to apply the patch to make sure it knows about JsonAPI in Core:
I believe this will properly:
But... all this comes after composer had finished with evaluating dependencies between modules / packages in my project. So composer actually looked for drupal/jsonapi and rejected my composer requirements:
Which is pretty stupid, right? (in fact, before I replaced "^7.0" by "^7.5", it downgraded Drupal Core to 8.x-7.5-RC2!
We just need a composer file. Without it this module can't be used with composer.
Here is a basic template based on the above patch for composer.json:
Nothing about as JsonAPI as... it is in Core.
I filled your name as maintainer. Please review and commit ;-)
Regards,
Comment #7
sashainparisComment #8
hussainweb@sashainparis, if I understand the output correctly, this error will be fixed if the patch we have in #2 is committed.
The Composer facade is using the .info.yml file to build the dependency graph and that is incorrect right now and the patch fixes that. Once the patch is committed, the d.o packager will update the generated composer.json as well.
Either way, I don't have strong opinions on having composer.json or not. I am just saying that I have seen it drift from the module's actual requirements before and hence I avoid it unless it is required. Here, I don't think it is required. We just need to commit the patch and also probably create a release.
Comment #9
sashainparisHi,
We need both:
- apply the patch #2 for Drupal API reasons (dependencies while enabling the module)
- add a composer.json file based on the template I gave in #6 (dependencies while building project code)
Regards,
Comment #10
hussainweb> add a composer.json file based on the template I gave in #6 (dependencies while building project code)
When the patch in #2 is applied and packaged, the composer.json will be updated to match the sample in #6. This means both problems are solved once it gets packages (not just committed).
Like I said before, my only concern with adding a composer.json is the drift that happens over time. If the maintainers feel composer.json should be there, that's fine too. It's just another file to maintain for no reason as far as I can see.
Comment #11
e0ipsoThis patch assumes that you are running >=D8.7. At the time of writing this D8.6 has not reached EOL yet.
Comment #12
e0ipsoComment #13
e0ipsoComment #15
e0ipsoI decided to make this module >=8.7
Merged.
Comment #16
hussainwebThanks @e0ipso,
With this, I see the composer require works for me:
Comment #17
sashainparisOK for me too.
It seems that D.O. provides composer data dynamically based on info files as no composer file is generated to be dowloaded.
Thanks.