Problem/Motivation

HAL was introduced during the development of D8. However, it never got much traction in the decoupled scene due to the vague specification and the particular quirks of the Drupal implementation. As a result few sites are using HAL in production. This speaks not to its usefulness, but to its worthiness to be shipped with core.

Additionally, JSON:API was recently committed into core and offers a superset of features over HAL. This makes HAL redundant in our codebase.

Finally, it's worth mentioning that the HAL module does not have any official maintainers. And has not had one for a while (4 years): https://git.drupalcode.org/project/drupal/blob/8.8.x/core/MAINTAINERS.tx...

Proposed resolution

1. Create a HAL project in contrib.

2. Deprecate HAL module in core in 9.3.x

3. Remove HAL module from 10.0.x

Remaining tasks

Agree on the deprecation strategy described.

User interface changes

None.

API changes

None.

Data model changes

None.

Release notes snippet

TBD

Comments

e0ipso created an issue. See original summary.

e0ipso’s picture

Issue summary: View changes
e0ipso’s picture

Wim Leers’s picture

larowlan’s picture

I've at least two contrib modules relying on hal - default_content and entity_pilot

I'd be happy to step up as maintainer if that's the primary removal reason

jibran’s picture

It is not just the maintainer issue. After adding JSON:API to core, the functionality HAL provides is almost the duplicate. The contrib modules require HAL can simply require drupal/hal using composer and will continue to work in D9.

Gábor Hojtsy’s picture

@mixologic has a core module usage breakdown snapshot from a few months back. I don't remember HAL usage from there, but it would be nice to see. The data is being reported to d.o by those sites using update module at least, which would be indicative of relative use (definitely not as absolute numbers), assuming we want to derive supporting data based on sites using update.module.

e0ipso’s picture

@Gábor Hojtsy do you think we should make this decision based on usage stats? That only speaks to one of the claims in the issue summary. The other two (no maintainers & being redundant now that JSON:API is in core) are still relevant regardless of the usage, right?

Gábor Hojtsy’s picture

I don't think that should be the only condition of decision, but it could help inform the decision.

e0ipso’s picture

Anyone has ideas on how to move this forward?

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Berdir’s picture

Title: Mark HAL module as deprecated in D8.8 so it can be removed in D9 » Mark HAL module as deprecated in D9 so it can be removed in D10
Version: 8.9.x-dev » 9.1.x-dev

Too late for D8.8, but I think moving it to contrib makes sense.

There are various issues that are very hard to resolve, see for example #2925520: Add a computed 'file_url' property to FileItem (for exposing file URL in file field normalization).

I'm also still relying on this through the default_content module, but hal+json became IMHO less and less convenient for that use case as core tried to make it more useful for REST, by adding more data, formatted representations, computed fields, formatted dates.. all things that are just in the way for how default_content uses it.

I've some thoughts on adding a custom serialization format to default_content that still covers what it needs (relationships, specifically but also things that are hard right now like files) while keeping it as close as possible to the raw data structure. There's also yaml_content as an alternative, but it's only alpha and has very few usages compared to default_content.

catch’s picture

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

xjm’s picture

Title: Mark HAL module as deprecated in D9 so it can be removed in D10 » [policy] Mark HAL module as deprecated in D9 so it can be removed in D10
Project: Drupal core » Drupal core ideas
Version: 9.2.x-dev »
Component: hal.module » Idea

Moving this to the Ideas queue for discussion there. (We separate the policy discussion from implementation for these since there are different needs.)

Gábor Hojtsy’s picture

The lack of maintainership is a problem. I agree the duplication of functionality is not useful either. Also JSON:API by this time has a much larger ecosystem of modules around it compared to HAL I believe. That said, #3158669: By default deprecate non-experimental modules that are used by less 5% of sites before the next major version indicates 12.5% use of HAL among reporting sites at the time. Given all of the above I would still lead to deprecate in Drupal 9 with removal for Drupal 10.

Gábor Hojtsy’s picture

Parenting to the right Drupal 10 meta. Removing product signoff tag, since I provided that in #16.

catch’s picture

We are a bit blocked on implementation with #3135100: [policy and meta] Provide a proper mechanism for deprecating modules and themes, but in terms of the overall decision, untagging for release manager review.

catch’s picture

Now that the lifecycle key has been added to .info.yml we're no longer blocked on implementation. Is anything more needed before we can go ahead with this one?

catch’s picture

Issue summary: View changes
Status: Active » Reviewed & tested by the community
andypost’s picture

There's nothing ce contrib instead of it
https://www.drupal.org/project/jsld

larowlan’s picture

Status: Reviewed & tested by the community » Fixed

This is done now

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.