- Issue created by @kevinquillen
- Status changed to Needs review
4 months ago 11:53am 28 August 2024 - 🇯🇵Japan ptmkenny
Thanks for this issue. I am now co-maintaining this module, and am attempting to clear out the issue queue.
It appears this module is designed to flatten the response, so I moved this to a feature request rather than a bug report.
I've added an MR that adds a new config option, "do not flatten", which will preserve the attribute and relationship keys. (Ideally, this would be a positive option like "Always flatten" rather than a negative one, but in the interest of preserving backwards compatibility, I am thinking that this is better as an opt-in checkbox.)
Please let me know what you think and if this MR works for your use case.
- 🇨🇾Cyprus alex.bukach
alex bukach → made their first commit to this issue’s fork.
- 🇫🇷France Mars0test
Hi
I read the topic and don't really get why you are doing this.
Just to include by default relatioships linked I guess. It's weird to go in the exact opposite way of the module. It'es seams this module is doing a job on the Jsonapi module to astract the Hateoas approach, if you use it, it's to hide the complexicity of th model.In the Hateoas model you can't force a consumer to get data that is not required (this is why I talk about abstract complexicity) Doing only half of the job or both of the job result to integrate something spectific to you need.
If you use the model Hateoas use the react lib. But if you use Jsonapi:include module, use a standard model that match with hydra or classic json model.
- 🇫🇷France Jérôme Dehorter Lille
jérôme dehorter → changed the visibility of the branch allow_keeping_includes to hidden.
- 🇯🇵Japan ptmkenny
ptmkenny → changed the visibility of the branch allow_keeping_includes to active.
- 🇯🇵Japan ptmkenny
@jérôme dehorter Please do not hide branches without leaving a comment about why you are doing so. I am the module maintainer and I wrote the MR, and I think it may be committed to the module, so the MR should stay open.
- 🇫🇷France Jérôme Dehorter Lille
jérôme dehorter → changed the visibility of the branch allow_keeping_includes to active.
- 🇫🇷France Jérôme Dehorter Lille
Hello @ptmkenny,
Sorry for this misclick. I change the visibility again.
- 🇺🇸United States kevinquillen
#10 the reason for this is to not break compatibility with Javascript deserializers written for JSON:API specification. The module can still include everything in the relevant areas as long as it does not drop 'attributes' 'relationships' etc. I suspect many libraries like JSONA simply expect them to exist with values. Without them, it cannot parse responses. You can see this here:
https://github.com/olosegres/jsona/blob/master/src/builders/JsonDeserial...
here is another example in another library:
https://github.com/SeyZ/jsonapi-serializer/blob/master/lib/deserializer-...
or another:
https://github.com/ShadowManu/jsonapi-deserializer/blob/master/src/index...
This would require frontend developers to write their own parsers which can take several dozens of hours or more. At least with the option the structure can be preserved without losing the additional features (including all resources possible).
- 🇫🇷France Jérôme Dehorter Lille
Good morning,
I tested the allow_keeping_includes branch with the Do not minimize the response enabled configuration and I don't see any change.
When the cache is empty, I will see the JSONAPI response of my content and everything is well integrated. I refreshed the page and nothing is present.
Drupal 10.3.2
Next 2.0.0-beta1
Multiple JSON:API extensions - Status changed to Needs work
19 days ago 3:29am 29 November 2024 - 🇨🇳China lawxen
^1.8 and 8.x-1.x (with no any patch) both has the problem of #17, Did anyone knows how to quick fix it?
- 🇨🇳China lawxen
I find my problem in #18 is caused by the include in jsonapi_defaults(submodule of jsonapi_extra), The default include in jsonapi_defaults won't take effect on the second request after clear the cache
- 🇯🇵Japan ptmkenny
@lawxen Please open a new issue if you found a bug in the dev branch; this is a feature request.
- 🇨🇳China lawxen
@ptmkenny New issue here Didn't support jsonapi_default 🐛 Didn't support jsonapi_default Active
- 🇯🇵Japan ptmkenny
@lawxen Thanks!
I'm setting this back to "Needs review" because the issue described in #17 and #20 is a separate bug that will be discussed here: 🐛 Didn't support jsonapi_default Active