The following patches are recommended or required for the module, based on your uses.
Schemata, Open API
If you wish to use Open API to generate documentation for your API instance, you'll need to apply the patch from #3084914-13: Support non-entity bundle types. The Commerce module leverages bundles that are not provided by a config entity type. The Schemata module currently does not handle bundles defined in code.
Drupal core
These patches are not required for normal use. But if you plan to install Commerce and JSON:API in a distribution using the config installation option, they are required. JSON:API causes route rebuilding during configuration imports. That means bundles provided by config entities do not exist and JSON:API's route provider crashes.
- #3086307: Improve installer performance by ~20% by rebuilding the router after the entire installation is complete rather than after each module
- #2996114: Argument 2 passed to Drupal\jsonapi\Routing\Routes::Drupal\jsonapi\Routing\{closure}() must be an instance of Drupal\jsonapi\ResourceType\ResourceType, NULL given
Issue fork commerce_api-3116465
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
mglamanComment #3
mglamanComment #4
mglamanComment #5
mglamanJSON:API Schema has a release with the fix.
Comment #6
dobe commentedWould be good to state that JSONAPI Extras is not compatible with this module.
Comment #7
z3cka commented+1 for mentioning that this module does not work with JSON:API Extras in the Docs & README.md. I tried applying the recommended patches etc. but still had issues with Open API doc generation.
Is there an issue for making this module compatible with JSON:API Extras? I'd love to know what the root of the problem is and can help test any patches.
In digging deeper, I found this thread on Drupal slack regarding jsonapi_extras.
Comment #8
mogio_hh commentedSo this means Drupal Commerce is not usable for headless projects like NextDrupal for example due to compatibility issues with JSON:API Extras? - Is there any headless Drupal project, that is not using "JSON:API Extras"?
Comment #9
mglamanYeah, just about every project I have been on!
Comment #10
z3cka commented@mogio_hh it seems that Druxt does not use JSON:API Extras, FWIW. Personally, I've gone away from JSON:API Extras as well because I don't really like modules that just make a bunch or random tweaks. Yes, they are convenient, but don't add much value beyond that, IMO.
Comment #11
bradjones1So I'm not sure this entirely boils down to "not compatible with extras" but, yeah, it's not compatible with extras. For SEO purposes I'll note here that I kept getting
::withRelatableResourceTypes() must be called before getting relatable resource types.on install and cache clear. I _think_ this is due to some sort of race condition with other decorators of the resource type repository, but after an hour of trying to track it down I basically gave up.Discussed with @mglaman briefly in Slack and it sounds like some maintenance has been done on this package to bring it up to speed with other ecosystem modules and core but it's a heavier lift than I'm looking to do, now.
Comment #13
anybodyThe documented patches at https://git.drupalcode.org/project/commerce_api/-/blob/8.x-1.x/README.md... need to be updated, they don't apply any more, I'll prepare a MR.
Comment #14
anybody- #2996114: Argument 2 passed to Drupal\jsonapi\Routing\Routes::Drupal\jsonapi\Routing\{closure}() must be an instance of Drupal\jsonapi\ResourceType\ResourceType, NULL given has been fixed (removed)
- #3086307: Improve installer performance by ~20% by rebuilding the router after the entire installation is complete rather than after each module has been fixed (removed)
- #3021930: Follow-up to SA-CONTRIB-2018-081: Restore JSON:API filter access has been fixed (removed)
- #3091299: Support entities that have non-config entity bundles has been fixed (removed)
- #3084914: Support non-entity bundle types is RTBC (would be nice to get it merged and released) - upated to https://www.drupal.org/files/issues/2023-06-05/3084914-22.patch
Guess this should be merged to bring the README.md suggested patches up to date.
Comment #16
anybody#3084914: Support non-entity bundle types is now fixed!
I'll remove it from the MR. #3091633: Support for cross bundle resource types is the last one now to be fixed for commerce_api! 🎉
Comment #17
socialnicheguru commentedThe recommended patch no longer applies to latest version: