spring-projects / spring-projects/spring-hateoas

Empty HAL-Forms options inline attribute should be serialized

Open
#2,438 10 comments 0 reactions 1 assignee View on GitHub

@odrotbohm is already working on this.

Since Apr 1, 2026.

in: mediatypes process: waiting for feedback
Dominant language
Java
Stars
1.1k
Forks
476
PR merge metrics
No merged PRs in 30d

Description

Currently, when HalFormsOptions.Inline#getInline is empty, the JSON inline attribute is excluded from the representation. This is because of:

https://github.com/spring-projects/spring-hateoas/blob/d6265fb1c360040c049830bb784b3e487a1542a8/src/main/java/org/springframework/hateoas/mediatype/hal/forms/HalFormsOptions.java#L39-L39

If we take a look at HAL-FORMS specification, we can read what follows:

If the inline attribute is missing or unparseable and the link (see link) attribute is missing or unparseable, then the options element SHOULD be ignored.

Therefore, IMO, from the spec POV, inline has 3 states:

  • missing
  • empty
  • non empty

Spring HATEOAS current behavior reduces this to 2 states:

  • missing
  • non empty

I think Spring HATEOAS should fix this to correctly represent the 3 states of the specification.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.