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.
Comment | File | Size | Author |
---|---|---|---|
#37 | 2997956--interdiff--34-37.txt | 8.91 KB | e0ipso |
#37 | 2997956--integrate-jsonapi-defaults--37.patch | 30.94 KB | e0ipso |
| |||
#34 | 2997956--integrate-jsonapi-defaults--34.patch | 29.07 KB | e0ipso |
#3 | join_extras_defaults-2997956-3.patch | 13.39 KB | mkolar |
| |||
#6 | 2997956--integrate-jsonapi-defaults--6.patch | 35.83 KB | e0ipso |
Comments
Comment #2
e0ipsoThis is exciting! 👏🏽
Comment #3
mkolar CreditAttribution: mkolar commentedHi :).. here is first try.. Its a plain submodule so no code changes in defaults or extras. I'll test this tomorrow probably. And Im not sure now about update hook if it should stay or not, Im not sure about workflow moving from standalone to submodule now (not sure if you need to uninstall standalone defaults first, than update extras and than enable it, than update hook is not needed).
Comment #4
e0ipsoGreat! Let me know when you're done with your testing. I'll add my review then.
Comment #5
yobottehg CreditAttribution: yobottehg commentedI gave this a testrun and it works great.
I would suppose to add the following:
This would help to get rid of default_includes like the following:
because this would be enough:
Here a little bit more elaboration why i think this would be a great next step and some more possible improvments
Comment #6
e0ipsoI made several adjustments to bring it up to speed to the latest available APIs. I also took the liberty to change the format slightly (see screenshot). On top of that I created some automated tests to make sure everything works as expected.
Finally, before we commit this we should turn those TODO items into drupal.org issues. In addition to that we'll need to have an issue to use service decoration instead of service swapping in jsonapi_defaults.
Please let me know about this.
Comment #8
e0ipsoFor some reason this is creating test patch failures for JSON API Extras. We'll need to figure this out before merging.
@mkolar I am not actively working on this anymore, will you take over bringing this to the finish line?
Comment #9
mkolar CreditAttribution: mkolar as a volunteer commentedHi, sorry for being away a while.. I was ill and lot of work to do in my regular job, can’t promise anything now. But will try to investigate why tests are failing.
Comment #10
mkolar CreditAttribution: mkolar as a volunteer commentedRegarding what @yobottehg wrote. Not sure it’s good idea to automatically include entities as suggested because sometimes you don’t want to expose something from included reference for example role from author.. but would be good that writing this “field_author.field_image.field_image” would be enough so no need to write all three lines for this entity. Also this is not good point for implement any new feature so let’s create new ticket as soon as this merge is done and discuss there.
Comment #11
Wim LeersWould this go into a new
8.x-3.x
branch?Comment #12
e0ipso@Wim Leers I'm not sure about that. I didn't really think about it. Any reason to require a major version change?
Comment #13
e0ipsoRe-roll
Comment #15
e0ipsoComment #16
ndobromirov CreditAttribution: ndobromirov at FFW commentedWill be able to push a bit in here in the next few days.
Comment #17
e0ipsoThat's fantastic news @ndobromirov!
Comment #18
rhristov CreditAttribution: rhristov at Bulcode commentedI have created a new patch that is compliant with JSON API 2.
Since the JSON API doesn't allow other modules to define normalizers I have created a new controller that overrides the one defined in JSON API. From this controller, I have added a method that overrides the one from JSON API which injects the includes.
Comment #20
rhristov CreditAttribution: rhristov at Bulcode commentedApplying a new patch and interdiff with the previous one, that I will hide.
There was an issue with the patch that I used as a starting point from #13 - when saving the include configurations they were not split per line.
Comment #21
Wim Leers@e0ipso: do you plan to add this to JSON API Extras
8.x-2.x
or8.x-3.x
?Comment #22
ndobromirov CreditAttribution: ndobromirov at FFW commentedI would consider this 2.x material, as it's an pure API addition. 3.x was added as a means to start clearing backwards compatibility overhead.
On top of that what's the update path for people in contrib that are still using jsonapi_defaults?
jsonapi_defaults works with jsonapi 1.x and jsonapi_extras 2.x (almost). Unless there is jsonapi_defaults in the 2.x extras, there is no way people can reach 3.x safely and incrementally (1 -> 2 -> 3).
Comment #23
Wim LeersExcellent point!
Comment #24
rhristov CreditAttribution: rhristov at Bulcode commentedI have created a new patch based on #20.
The difference is that we are changing the way we alter the JSONAPI controller to inject the includes: previously we were relying on route subscriber and now we are overriding the controller defined as a service.
Applying an interdiff with the changes from the previous patch.
Comment #25
rhristov CreditAttribution: rhristov at Bulcode commentedComment #27
ndobromirov CreditAttribution: ndobromirov at FFW commentedPatch does not apply against latest dev :(.
@Rosen, can you try resolving the problematic tests as well?
Comment #28
rhristov CreditAttribution: rhristov at Bulcode commentedApplying a new patch created from #20.
Changes:
Added a dependency on jsonapi_defaults submodule to jsonapi v2.
Fixed coding standard issues.
Comment #30
rhristov CreditAttribution: rhristov at Bulcode commentedThe tests are failing, but it is not related to the applied patch.
When executed against the latest dev version they are failing with same output.
I will try to resolve the tests, but I will appreciate if someone gets involved too.
As a hint, I saw that when the tests are running the \Drupal\jsonapi_extras\ResourceType\ConfigurableResourceTypeRepository::isJsonApi2x returns TRUE no matter that it tests against JSONAPI v1.
Comment #31
e0ipsoLet's try against
8.x-3.x
.Comment #32
e0ipsoComment #33
rhristov CreditAttribution: rhristov at Bulcode commented@e0ipso see this comment here: https://www.drupal.org/project/jsonapi_extras/issues/3017255#comment-128... , once merged we could retest the latest patch.
Comment #34
e0ipsoLet's see if we can apply against 3.x instead.
Comment #36
e0ipso@rhristov it seems we are a bit closer on this. Can you take a look at the failing test and do some manual testing of your own?
I had to remove you from the composer.json since we only list there the original authors of the modules. That was part of the agreement in #2985845: Join efforts: Consider merging with JSON API Extras. I hope you understand. Your contribution is really valued! and credit will be granted on commit.
Comment #37
e0ipsoAlright, let's see if now we are good!
Comment #38
e0ipsoComment #39
e0ipsoGreat! Tests are green. Can someone else test this patch manually before committing?
Comment #40
ndobromirov CreditAttribution: ndobromirov at FFW commentedWill add it to our builds some time today and ping back.
Comment #41
e0ipsoAwesome! Thanks for that.
Comment #42
mkolar CreditAttribution: mkolar as a volunteer commentedHello guys, thanks for the work. Since i didn't have time to finish this I've just spent some time testing it in my projects at least... and looks like it all works as before after some configuration!
installed version
"name": "drupal/core",
"version": "8.6.3",
"name": "drupal/jsonapi",
"version": "2.0.0-rc2",
"name": "drupal/jsonapi_extras",
"version": "3.0.0-rc3",
+ patch https://www.drupal.org/files/issues/2018-12-06/2997956--integrate-jsonap...
Comment #43
e0ipsoComment #45
e0ipsoGreat work everyone!
@mkolar, can you mark JSON API Defauluts as deprecated in the module page and point people here to JSON API Extras?
Comment #46
mkolar CreditAttribution: mkolar as a volunteer commented@e0ipso I already did that day you committed it here.