- Issue created by @das-peter
- 🇨🇭Switzerland das-peter
First draft created.
Reviews and overall feedback welcome.
Tests are currently missing - don't have the setup ready yet - still setting to "Needs Review" to get first feedback. - 🇨🇭Switzerland ayalon
We also found this issue but decided to not fix it in GraphQL Core Schema.
We rely fully on Drupal Core in terms of routing. The issue is an underlying bug in Drupal core.You can find the issue here:
https://www.drupal.org/project/drupal/issues/1255092 🐛 url() should return / when asked for the URL of the frontpage Needs workIf you use for example the patch in #41, the issue is solved.
https://www.drupal.org/files/issues/2022-03-31/1255092-41.patch →What do you think?
- 🇨🇭Switzerland das-peter
@ayalon Thanks for the feedback! Was totally not aware of that core issue.
That obviously explains whyif ($value !== $target_url ...
is tripped.Would it be better to change the routing logic in our module?
That's a good question. If core gest fixed that's a pretty essential change in how the frontend path behaves. I guess that's also why concerns about needing a CR for this change were raised.
That said, if the behavior changes and we transparently forward the change we probably break 3rd-party APIs that have no affiliation with Drupal. Within Drupal itself we might can handle this using version constraints - but not with API dependencies.This again would make me wonder if instead of being a query property this could be a routing-setting in the GraphQL Core Schema config.
My first local implementation was actually built as a setting and not a query argument.
A setting would allow us to maintain / toggle the behavior transparently (without the need to change the queries) - which would avoid API breaks.Overall I wonder how soon we can expect an official change.
I wouldn't bet on any time soon - the need is still here thought.
That said and with above considerations I propose to expand the current patch and add the mentioned configuration.
In case the core change comes, the setting is in place and an update hook or another condition can take care of maintaining API behavior for all pre-existing Graphql configs.Let me know what you think - happy to extend the patch.