Active
Project:
JSON:API
Version:
8.x-2.4
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
18 Dec 2018 at 09:46 UTC
Updated:
9 Aug 2022 at 20:25 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
wim leersThanks for taking the time to report this! 🙏
I think that's a reasonable expectation, but it would be a new feature. This has never been supported.
Comment #3
wim leersThis is not yet passing tests, but something like this is the test coverage we'd want, and which this feature is asking to pass.
Comment #4
gabesullice+1
Comment #5
wim leersI think #3025372: [regression] Impossible to filter for resources with an empty relationship object in JSON:API 2.x is related. At least conceptually, but potentially also in terms of patch.
Comment #6
wim leers#3025372: [regression] Impossible to filter for resources with an empty relationship object in JSON:API 2.x just landed! Let's push this forward now.
Comment #7
bucefal91 commentedHello, guys!
Correct me if I am wrong, but I think we "done-done" here just because the other issue (#3025372: [regression] Impossible to filter for resources with an empty relationship object in JSON:API 2.x) has been resolved.
/jsonapi/taxonomy_term/campaign_goal?filter[alex][condition][path]=parent.id&filter[alex][condition][operator]=IS NULLyields the correct result to me on a 8.9.3 core, i.e. to fetch the top-most terms you just query for such terms whose parent is NULL.
I think to make this issue entirely resolved, the only thing I would propose additionally is to update the docs pages related to the to state the exact way you can filter things.
Comment #8
arakwarI am going to correct you :)
This works when you are logged in, in Drupal 9.4.5. When the request is done by an anonymous user, it's empty.
EDIT : We found a way to make it work. You need to filter by parent.id and leave the value field empty.